#include <bits/stdc++.h>
int main() {
  int32_t num_cities;
  std::cin >> num_cities;
  std::vector<std::pair<int32_t, int32_t> > edges;
  for (int32_t i = 0; i + 2 <= num_cities; i += 2) {
    for (int32_t j = 0; j < num_cities - i - 1; j++)
      edges.emplace_back(j, j + i + 1);
  }
  std::cout << edges.size() << "\n";
  for (int32_t i = 0; i < edges.size(); i++)
    std::cout << edges[i].first + 1 << " " << edges[i].second + 1 << "\n";
  return 0;
}
