#define _USE_MATH_DEFINES #include using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); int x; cin >> x; vector scores(x + 1); iota(scores.begin(), scores.end(), 0); for (int i = 1; i <= x; i++) for (int j = i; j <= x; j += i) --scores[j]; int mi = 1 << 30; for (int i = 1; i < x; i++) mi = min(mi, abs(scores[i] - scores[x - i])); vector> ans; for (int i = 1; i < x; i++) if (abs(scores[i] - scores[x - i]) == mi) ans.emplace_back(i, x - i); for (auto& p : ans) { cout << p.first << " " << p.second << '\n'; } return 0; }