#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int k;
    cin>>k;
    
    int t;
    int red[100];
    int r=0,rez=0;
    while(k>3)
    {
       t=cbrt(6*k);
       if(t*(t+1)*(t+2)>6*k) t=t+1;
       else t=t+2;
       red[r]=t;
       rez+=t;
       r++;
       k=k-t*(t-1)*(t-2)/6;
    }
    while(k>0)
    {
       red[r]=3;
       r++;
       rez+=3;
       k--;
    }
    int s=0;
    cout<<rez<<endl;
    int i=0;
    while(i<r)
    {
       for(int j=s;j<s+red[i];j++)
       {
          cout<<i<<" "<<j<<endl;
       }
       s+=red[i];
       i++;
       
       if(r>1 && i<r)
       {
       for(int j=s;j<s+red[i];j++)
       {
          cout<<i<<" "<<j<<endl;
       }
       
       s+=red[i];
       s+=red[i]+red[i-1];
       i++;
       }
    }
    
    
    
    return 0;
}