#include <iostream>
using namespace std;


bool is_balanced(int n);


int main() {
  int n;
  while (cin >> n) cout << is_balanced(n) << endl;
  return 0;
}
