#include #include #include #include constexpr int X = 2000000; std::vector pcnt(X + 1, 1); void init() { for (int p = 2; p <= X; ++p) { if (pcnt[p] > 1) continue; for (int q = p; q <= X; q += p) { int cnt = 0, x = q; while (x % p == 0) { x /= p; ++cnt; } pcnt[q] *= cnt + 1; } } } void solve() { int x; std::cin >> x; int dmin = x; std::vector ans; for (int a = 1; a < x; ++a) { int b = x - a; int fa = a - pcnt[a], fb = b - pcnt[b]; int d = std::abs(fa - fb); if (d < dmin) { dmin = d; ans.clear(); } if (d == dmin) ans.push_back(a); } for (auto a : ans) { std::cout << a << " " << x - a << std::endl; } } int main() { std::cin.tie(nullptr); std::cout.tie(nullptr); std::ios::sync_with_stdio(false); init(); solve(); return 0; }