#include using ll = long long; using std::cin; using std::cout; using std::endl; std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count()); template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const int inf = (int)1e9 + 7; const long long INF = 1LL << 60; void solve() { int K; cin >> K; const int N = 16; std::vector dp(1 << N, std::vector(216 * 2 + 1)); dp[0][216] = 1; auto enc = [&](const int h, const int w) { return h * 4 + w; }; auto dec = [&](const int S) { return std::make_pair(S / 4 , S % 4); }; const int dh[] = {-1, 0, 1, 0}; const int dw[] = {0, -1, 0, 1}; for (int S = 0; S < (1 << N); ++S) { int nxt = 1; for (int i = 0; i < N; ++i) { nxt += (S >> i & 1); } for (int s = 0; s <= 216 * 2; ++s) { if(dp[S][s] == 0) continue; for (int i = 0; i < N; ++i) { if(~S >> i & 1) { int ns = s; const auto [h, w] = dec(i); for (int k = 0; k < 4; ++k) { const int nh = h + dh[k]; const int nw = w + dw[k]; if(nh < 0 or nh >= 4 or nw < 0 or nw >= 4) continue; if(S >> enc(nh, nw) & 1) { ns += nxt; } else { ns -= nxt; } } if(ns >= 0 and ns <= 216 * 2) { dp[S | (1 << i)][ns] += dp[S][s]; } } } } } cout << dp[(1 << N) - 1][216 + K] << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int kkt = 1; // cin >> kkt; while(kkt--) solve(); return 0; }