func_code_string: #include <bits/stdc++.h>   const int Maxn = 500000;   int n;   struct Answer {     int l, r;   } a[Maxn + 5];   int len;   void work(int left, int right) {     if (left == right) {       return;     }     int mid = (left + right) >> 1;     work(left, mid);     work(mid + 1, right);     for (int i = left; i <= mid; i++) {       a[++len].l = i;       a[len].r = mid + (i - left + 1);     }   }   int main() {     scanf( %d , &n);     if (n <= 2) {       puts( 0 );       return 0;     }     int lim = 1;     while (lim <= n) {       lim <<= 1;     }     lim >>= 1;     work(1, lim);     int m = n - lim;     if (m > 0) {       int sz = 1;       while (sz < m) {         sz <<= 1;       }       work(n - sz + 1, n);     }     printf( %d n , len);     for (int i = 1; i <= len; i++) {       printf( %d %d n , a[i].l, a[i].r);     }     return 0;   }   