#include <bits/stdc++.h>
using namespace std;
const long long LLINF = 8e18;
const int MOD = 998244353;
const int INF = 2e9;
const int N = 1e6;
int n, t;
int f[N + 1];
int ans;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    f[i] = 1LL * f[i - 1] * i % MOD;
  }
  ans = f[n];
  t = 1;
  for (int i = n; i >= 3; i--) {
    t = 1LL * t * i % MOD;
    ans = (0LL + ans + 1LL * t * (0LL + f[i - 1] - 1)) % MOD;
  }
  cout << ans;
  return 0;
}
