#include using namespace std; const long long MOD = 998244353; int main(){ int N; cin >> N; vector dp(1 << N, 0); dp[(1 << N) - 1] = 1; int ans = 0; for (int i = (1 << N) - 1; i >= 1; i--){ if (i != (1 << N) - 1){ int l = N, r = 0; for (int j = 0; j < N; j++){ if (i >> j & 1){ l = min(l, j); r = max(r, j); } } if (r - l + 1 == __builtin_popcount(i)){ ans += dp[i]; ans %= MOD; continue; } } for (int j = 0; j < N; j++){ if (i >> j & 1){ dp[i - (1 << j)] += dp[i]; dp[i - (1 << j)] %= MOD; } } } cout << ans << endl; }