#include <iostream>
#include <cstdlib>
#include <vector>

constexpr int p = 998244353;
constexpr int inv2 = (p + 1) >> 1;

int add(int x, int y) { return (x += y) >= p ? x - p : x; }
int mul(int x, int y) { return static_cast<unsigned long long>(x) * y % p; }

struct matrix {
    int r, c;
    std::vector<std::vector<int>> val;
    matrix(): r(0), c(0) {}
    matrix(int r, int c): r(r), c(c) {
        val.resize(r);
        for (int i = 0; i < r; ++i) val[i].resize(c);
    }
    matrix operator *(const matrix& a) {
        matrix ans(r, a.c);
        for (int k = 0; k < c; ++k)
            for (int i = 0; i < r; ++i)
                for (int j = 0; j < a.c; ++j) {
                    ans.val[i][j] = (static_cast<unsigned long long>(val[i][k]) * a.val[k][j] + ans.val[i][j]) % p;
                }
        return ans;
    }
} all[105];

bool comp(const matrix& a, const matrix& b) {
    if (a.r != b.r) return false;
    if (a.c != b.c) return false;
    for (int i = 0; i < a.r; ++i)
        for (int j = 0; j < a.c; ++j)
            if (a.val[i][j] != b.val[i][j]) return false;
    return true;
}

int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(nullptr);
    int n;
    std::cin >> n;
    matrix base(n, n);
    for (int i = 0, j = 0; i < n; i += 2, ++j) {
        base.val[i][j] = base.val[i][n - 1 - j] = base.val[i + 1][j] = base.val[i + 1][n - 1 - j] = 1;
    }
    matrix now(n, n);
    for (int i = 0; i < n; ++i) now.val[i][i] = 1;
    for (int i = 1; i <= 100; ++i) {
        std::cerr << i << '\n';
        now = now * base;
        int min = 1000000000;
        for (int j = 0; j < n; ++j)
            for (int k = 0; k < n; ++k)
                min = std::min(min, now.val[j][k]);
        all[i] = matrix(n, n);
        for (int j = 0; j < n; ++j, std::cerr << '\n')
            for (int k = 0; k < n; ++k) {
                std::cerr << (all[i].val[j][k] = now.val[j][k] - min) << ' ';
            }
        for (int j = 1; j < i; ++j)
            if (comp(all[j], all[i])) {
                std::cerr << j << ' ' << i << '\n';
                std::exit(0);
            }
    }
    return 0;
}
