#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;

ll coma(ll& n)
{ return n*(n-1)*(n-2)/6;
}
int main()
{ ll i, k, n, suma, tac, duz, maxa, kraj, poc, ima;
  cin>>n;
  vl koka(851);
  vl niz(1);
  koka[3]=1;
  for(i=4;i<=850;i++) koka[i]= i*(i-1)*(i-2)/6;
  suma=n; tac=2000;
  while(suma>0)
    { i=3;
      while(koka[i]<=suma)i++;
      i--;
      suma-=koka[i];
      niz.push_back(i);
      tac-=i;
    }
   duz=niz.size()-1;
   tac=2000-tac;
   //cout<<endl<<"Tacaka korisceno = "<<tac;
   //for(i=1;i<=duz;i++) { cout<<endl<<"i = "<<niz[i]<<" daje = "<<koka[niz[i]];  }
   vl dot(duz+1);
   dot[1]=0;
   if(duz>1)//vise od jedne duzi
   { dot[2]=0;
     for(i=3;i<=duz;i++)
      { poc=dot[i-2];
        kraj=dot[i-1]+niz[i-1];
        dot[i]=dot[i-2]+2*(kraj-poc+1);
      }
   }
   //for(i=1;i<=duz;i++) {cout<<endl<<dot[i]<<" "<<dot[i]+niz[i]-1;}
   //cout<<"\n\n";

   cout<<tac<<endl;
   ima=niz[1];
   for(i=0;i<ima;i++) cout<<"1 "<<i<<"\n";
   if(duz>1)
     {  ima=niz[2];
        for(i=0;i<ima;i++) cout<<"2 "<<i<<"\n";
        for(i=3;i<=duz;i++)
         { poc=dot[i];
           kraj=poc+niz[i]-1;
           for(k=poc;k<=kraj;k++) cout<<i<<' '<<k<<"\n";
         }
     }
 return 0;
}