#include <stdio.h>
#include <vector>
#include <utility>

int main() {
    int n; scanf("%d", &n);

    int latte = n + 1 - n % 2;
    std::vector<std::pair<int, int>> edges;
    for(int i = 1; i <= n; i++) {
        for(int j = i + 1; j <= n; j++) {
            if(i + j == latte) continue;
            edges.push_back({i, j});
        }
    }

    printf("%d\n", edges.size());
    for(auto e: edges) printf("%d %d\n", e.first, e.second);
    return 0;
}
