#include<bits/stdc++.h>
using namespace std;

/* FastIO by rsk0315 (last update: 2018/02/21 00:36) */

namespace FastOut {
    static constexpr size_t BUF_SIZE=1<<17, INT_LEN=24, FLT_LEN=400;
    static constexpr char FLT_FMT[]="%.16f";
    static char buf[BUF_SIZE|1]={}, *pos=buf, *endbuf=pos+BUF_SIZE;
    FILE *fout;

    inline void flush() {
        std::fwrite(buf, 1, pos-buf, fout);
        pos = buf;
    }

    inline void print(const char out) {
        if (pos == endbuf) {
            flush();
        }
        *pos++ = out;
    }

    inline void print(const char *out) {
        size_t len=std::strlen(out);
        if (pos + len >= endbuf) {
            flush();
            if (len >= BUF_SIZE) {
                std::fwrite(out, 1, len, fout);
                return;
            }
        }
        std::memcpy(pos, out, len);
        pos += len;
    }

    inline void print(char *out) {
        size_t len=std::strlen(out);
        if (pos + len >= endbuf) {
            flush();
            if (len >= BUF_SIZE) {
                std::fwrite(out, 1, len, fout);
                return;
            }
        }
        std::memcpy(pos, out, len);
        pos += len;
    }


    template <class Char, size_t Len>
    inline void print(const Char (&out)[Len]) {
        print(&out[0]);
    }

    inline void print(const double out) {
        char minibuf[FLT_LEN];
        size_t len=std::snprintf(minibuf, FLT_LEN, FLT_FMT, out);
        if (pos + len >= endbuf) {
            flush();
        }
        std::memcpy(pos, minibuf, len);
        pos += len;
    }

    inline void print(const bool out) {
        print(out? "true":"false");
    }

    template <class Int>
    inline void print(Int out) {
        static_assert(std::is_integral<Int>::value, "For integers only");

        if (out == 0) {
            if (pos == endbuf) {
                flush();
            }
            *pos++ = '0';
            return;
        }

        char minibuf[INT_LEN], *minipos=minibuf+INT_LEN;
        if (std::is_signed<Int>::value && out < 0) {
            if (pos == endbuf) {
                flush();
            }
            *pos++ = '-';
            if (out == std::numeric_limits<Int>::min() && Int(-1) == ~Int(0)) {
                // In two's complement representation, we could not represent the
                // absolute value of minimum (maximum-magnitude negative) value.
                // Without this branch, we would overflow (undefined behavior) by
                // the value.  If we know the input is never the value, we can
                // remove this branch and save (nanoseconds-order) time.
                switch (sizeof out) {
                    case 1:
                        return (void)(print("128"));
                    case 2:
                        return (void)(print("32768"));
                    case 3:
                        return (void)(print("8388608"));
                    case 4:
                        return (void)(print("2147483648"));
                    case 8:
                        return (void)(print("9223372036854775808"));
                    case 16:
                        return (void)(print("170141183460469231731687303715884105728"));
                    default:
                        // Regardless of the number of its bytes, lowest (decimal) digit
                        // is always eight, but other digits depend on it.
                        *--minipos = '8';
                        out /= -10;
                }
            } else {
                out = -out;
            }
        }

        // We know the division is too slow; we wish we could avoid using them
        // TWICE PER LOOP!  ...Now, we notice that compilers are so smart that
        // can replace it by shift operations...  The division-compatible
        // instructions for unsigned are shorter than ones for signed.
        typename std::make_unsigned<Int>::type out_=out;
        do {
            *--minipos = '0' + out_%10;
            out_ /= 10;
        } while (out_ > 0);

        size_t len=(minibuf+INT_LEN)-minipos;
        if (pos + len >= endbuf) {
            flush();
        }
        std::memcpy(pos, minipos, len);
        pos += len;
    }

    class Printer {
        inline void flush() {
            FastOut::flush();
        }

    public:
        Printer(FILE *fout=stdout) {
            FastOut::fout = fout;
        }

        ~Printer() {
            flush();
        }

        template <class T>
        inline void print(const T out) {
            FastOut::print(out);
        }

        template <class First, class... Rest>
        inline void print(const First &out, const Rest &...outs) {
            FastOut::print(out);
            Printer::print(outs...);
        }

        template <class... T>
        inline void println(const T... out) {
            Printer::print(out...);
            FastOut::print('\n');
        }
    };
}

int main(){
    FastOut::Printer out;
    long N;
    cin >> N;
    if(N > 4){
        if(N & 1){
            out.println(2 * (N - 1));
            out.println("1 ", N, "\n", N - 1, " ", N);
            out.println(N / 2, " ", N, "\n", (N + 1) / 2, " ", N);
            for(long i = 1; i * 2 + 1 != N; ++i){
                out.println(i, " ", i + 1);
                out.println(i, " ", N - (i + 1));
                out.println(N - i, " ", i + 1);
                out.println(N - i, " ", N - (i + 1));
            }
        }else{
            out.println(2 * N);
            out.println("1 ", N / 2, "\n", "1 ", (N + 2) / 2);
            out.println(N, " ", N / 2, "\n", N, " ", (N + 2) / 2);
            for(long i = 1; i * 2 != N; ++i){
                out.println(i, " ", i + 1);
                out.println(i, " ", N - i);
                out.println(N - i + 1, " ", i + 1);
                out.println(N - i + 1, " ", N - i);
            }
        }
    }else if(N == 3){
        puts("2\n1 3\n2 3");
    }else if(N == 4){
        puts("4\n1 2\n2 4\n3 4\n3 1");
    }
}

Measured memory_bytes: 256