#include <bits/stdc++.h>

using namespace std;
vector<int> sol;
int totalSum = 0;
bool ft = false;
int resenja[1101]; 
void napraviTacke(int k, int c)
{
    if (k == 0)
        return;
    // n * (n-1) * (n-2) / 6  <= k
    // (n^2 - n) * (n-2) == n^3 -3n^2 - 2n - 6k <= 0
    int i = upper_bound(resenja, resenja+1101, k)-resenja-1;    
    if (!ft) {
        sol.push_back(i);
        totalSum += i;
         ft = true;       
    } else {
        sol.push_back(i-1);
        totalSum += i-1;   
    }
    napraviTacke(k - resenja[i], c+1);
    
   
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int k;
    cin >> k;
    for (int i = 0; i <= 1100; i++)
        resenja[i] = (i*(i-1)*(i-2))/6;   
    napraviTacke(k, 0);
    cout << totalSum << "\n";
    int x = 0, y = 0, delta = 0;
    for (int l : sol) {        
        while (l--) {
            cout << x << " " << y << "\n";
            y += 1;
            x += delta;
        }
        delta += 1;
        x += 1;
    }
}