#include <bits/stdc++.h>
using namespace std;
long long n, a[1000005], b[1000005];
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n;
  a[0] = 1ll, a[1] = 1ll;
  for (long long i = 2; i <= n; ++i)
    a[i] =
        (i * ((2 * a[i - 1] - i * a[i - 2] + a[i - 2] + i - 2) % 998244353)) %
        998244353;
  if (a[n] < 0) a[n] += 998244353;
  cout << a[n];
}
