#include <bits/stdc++.h>
using namespace std;
const int k[101] = {15, 14, 12, 13, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7};
int n;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  cout << k[n] << endl;
  return 0;
}
