#include<iostream>
using namespace std;
const int N=1e6+10;
int st[N],primes[N],cnt;
void init(int n){
for(int i=2;i<=n;i++){
if(!st[i]) primes[cnt++]=i;
for(int j=0;primes[j]<=n/i;j++){
st[primes[j]*i]=true;
if(i%primes[j]==0) break;
}
}
}
int main(){
int n;
cin>>n;
init(n);
for(int i=0;i<cnt;i++){
int p=primes[i];
int c=0;
int s=n;
while(s){
c+=s/p;
s/=p;
}
cout<<p<<" "<<c<<endl;
}
return 0;
}