#include #include #include using namespace std; const int INF = 10000000; int main(){ int X; cin >> X; vector d(X, 0); for (int i = 1; i < X; i++){ for (int j = i; j < X; j += i){ d[j]++; } } vector f(X); for (int i = 1; i < X; i++){ f[i] = i - d[i]; } vector> ans; int mn = INF; for (int i = 1; i < X; i++){ int d = abs(f[i] - f[X - i]); if (mn > d){ ans.clear(); mn = d; } if (mn == d){ ans.push_back(make_pair(i, X - i)); } } int sz = ans.size(); for (int i = 0; i < sz; i++){ cout << ans[i].first << ' ' << ans[i].second << endl; } }