#include <bits/stdc++.h>

using namespace std;

long long bk(long long n,long long k){
	double total=1;
    for(int i = 1; i <= k; ++i)
        total=total*(n-k+i)/i;
    return (long long)(total+0.01);
}

long pamti[1000];


int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    long i=0, j=0, k=0, a=0, br=0, n=3 ,pok=1;
    
    
    cin>>k;
    n=3;
    long ostalo=0;
    while(bk(n,3)<=k)n++;
		
	n=n-1;
	ostalo=bk(n,3);
	int gde=n+1;
	pamti[0]=gde;
	
 	while((k-ostalo)!=0){
 		a=3; 
	while(bk(a,3)<=(k-ostalo)){
		a++;
	}
	a=a-1;
	ostalo+=bk(a,3);
	for(int i=n+1; i<=n+a; ++i){
		gde++;
		br=i;
	}
	pamti[pok]=gde;
	pok++;
	n=br;	
}

cout<<n<<endl;
k=0;
j=0;
for(int i = 1; i<=n; ++i){
 if(pamti[k]==i){
	k++;
	j++;
	cout<<i<<" "<<j<<endl;
	}
	else if(pamti[k]!=i){
	cout<<i<<" "<<j<<endl;
	}	
}	
	return 0;
}