#include <bits/stdc++.h>
using namespace std;
int n, k;
int invert(unsigned x) {
  unsigned s = 0;
  for (int i = 0; i < 4; i++) {
    s = s * 2 + (x & 1);
    x /= 2;
  }
  return s;
}
int main(void) {
  unsigned n;
  cin >> n;
  cout << invert(invert(n) - 1);
  return 0;
}
