#include <bits/stdc++.h>
#define pb push_back
#define mid(l, r) ((l)+(r))/2
#define len(a) (a).length()
#define sz(a) (a).size()
#define xx first
#define yy second
#define ll long long 			//-+ 9,223,372,036,854,775,807  = 9.2*10^18 = 2^63 - 1
#define ull unsigned long long	// +18,446,744,073,709,551,615  = 1.8*10^19 = 2^64 - 1
#define l long					//-+ 			 2,147,483,647	= 2.1*10^9  = 2^31 - 1
#define ul unisgned long		// +			 4,294,967,295	= 4.3*10^9	= 2^32 - 1
#define db double
#define ldb long double
#define ff(i,n) for(int (i) = 0; i < (n); ++i)
#define fff(i,a,b) for(int (i) = (a); (i)<=(b); ++i)
#define ffb(i,a,b) for(int (i) = a; i >= b; --i)

using namespace std;


ll choose(ll n,ll k){
	double res = 1;
    for (int i = 1; i <= k; ++i)
        res = res * (n - k + i) / i;
    return (ll)(res + 0.01);
}


l gdeshift[20000];
int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    const int LIM=0;

    l i=0,j=0,k=0,a=0,b=0,n=0,t=1,x=0;
    l  sol=0,ans=0,rez=0;
    
    cin >> k;
    n=3;
    ll imamo=0;
    while(choose(n,3)<=k){
    	n++;
    	
	}
	
	
	n=n-1;
	
	imamo=choose(n,3);
	
	
	int shifted=n+1;
	gdeshift[0]=shifted;
	
	
 	while((k-imamo)!=0){
 		a=3;
	 
	while(choose(a,3)<=(k-imamo)){
		a++;
	}
	a=a-1;
	imamo=imamo+choose(a,3);
	fff(i,n+1,n+a){
		shifted++;
		b=i;
	}
	gdeshift[t]=shifted;
	t++;
	n=b;
	
}

cout<<n<<endl;
k=0;
j=0;
fff(i,1,n){
	
	if(gdeshift[k]!=i){
	
	cout<<i<<" "<<j<<endl;
}
else if(gdeshift[k]==i){
	k++;
	j++;
	cout<<i<<" "<<j<<endl;}
	
	
}
	

	

	return 0;
}