#include <iostream>
#include<cmath>
using namespace std;
typedef unsigned long long ll;
ll tong[1000000];
int main(){
ll a,b=1;
cin>>a;
for(ll i=2;i<=a;i++){
for(ll j=2;j<=sqrt(i);j++){
int cnt=0;
b=i;
while(b%j==0){
cnt++;
b/=j;
}
tong[j]+=cnt;
if(b!=0){
tong[b]++;
}
}
}
for(int i=2;i<1000000;i++){
if(tong[i]!=0){
cout<<i<<" "<<tong[i]<<endl;
}
}
return 0;
}