#include<bits/stdc++.h>
#define maxn 105
using namespace std;
int n;
int sum[maxn];
int main()  {
    cin>>n;
    int s=n|1;
    if (~n&1)    cout<<n*(n-1)/2-n/2<<endl; else cout<<n*(n-1)/2-(n-1)/2<<endl;
    for (int i=1;i<=n;++i)
        for (int j=1;j<i;++j)
            if (i+j!=s)
                printf("%d %d\n",i,j),sum[i]+=j,sum[j]+=i;
    for (int i=1;i<=n;++i)  assert(sum[i]==n*(n+1)/2-s);
    return 0;
}