#include using namespace std; typedef long long ll; int main() { ll M; cin >> M; ll x = 1; for (int i=0; i<128; ++i) { x *= 2; x %= M; } cout << x << endl; return 0; }