import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "x", long, "y");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    auto n = lread();
    long[Pair] edge;
    foreach (i; iota(n))
    {
        foreach (j; iota(i, n))
        {
            if (i != j)
                edge[Pair(i + 1, j + 1)] = 1;
        }
    }
    auto t = n + (n + 1) % 2;
    // t.writeln();
    foreach (i; iota(1, n + 1))
    {
        if (Pair(i, t - i) in edge)
            edge.remove(Pair(i, t - i));
    }
    writeln(edge.length);
    foreach (key, value; edge)
    {
        writefln("%s %s", key.x, key.y);
    }
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}
