// No.638 Sum of "not power of 2" // // #include #include #include #include using namespace std; long long int solve(long long int N); bool is_valid(long long int a, long long int b, set &prohibits); int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); long long N; cin >> N; long long ans = solve(N); if (ans != -1) cout << ans << " " << N - ans << endl; else cout << ans << endl; } long long int solve(long long int N) { set prohibits; for (auto i = 0; i < 61; ++i) prohibits.insert(pow(2, i)); long long ans = -1; long long a, b; for (auto i = 0; i < 61; ++i) { long long t = pow(2, i); a = t - 1; b = N - a; if (is_valid(a, b, prohibits)) { ans = a; break; } a = t + 1; b = N - a; if (is_valid(a, b, prohibits)) { ans = a; break; } } return ans; } bool is_valid(long long int a, long long int b, set &prohibits) { if (a < 1 || b < 1) return false; if (prohibits.find(a) != prohibits.end()) return false; if (prohibits.find(b) != prohibits.end()) return false; return true; }