#include <bits/stdc++.h>
long long int level[1000005], c[1000005];
int main(int argc, char const *argv[]) {
  int n;
  long long int mod = 998244353;
  scanf("%d", &n);
  level[0] = 1;
  c[0] = n;
  for (int i = 1; i <= n; ++i) level[i] = (level[i - 1] * i) % mod;
  for (int i = 1; i <= n; ++i) c[i] = (c[i - 1] * (n - i)) % mod;
  long long int count = level[n];
  for (int i = 2; i <= n - 1; ++i) {
    count = (count + level[n] - c[n - i - 1]) % mod;
    if (count < 0) count += mod;
  }
  int ans = count;
  printf("%d", ans);
  return 0;
}
