#include<bits/stdc++.h>
using namespace std;
int n,q[99999];
int num=1;
int read()
{
int x = 0;
char ch = getchar();
while (ch >= '0' && ch <= '9')
{
x = x * 10 + ch - '0';
ch = getchar();
}
return x;
}
bool p(int x){
for(int i=2;i*i<=x;i++){
if(x%i==0){
return 0;
}
}
return 1 ;
}
void f(int x,int y){
if(x%y==0){
q[y]++;
}
else return;
x/=y;
f(x,y);
}
int main(){
n = read();
for(int i=1;i<=n;i++){
for(int j=2;j<=n;j++){
if(p(j)==1 && i%j==0){
f(i,j);
}
}
}
for(int i=1;i<=n;i++){
if(q[i]>0){
printf("%d %d\n", i, q[i]);
}
}
return 0;
}