#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353, N = 1e6 + 5;
long long fact[N], d[N];
long long f(int x) {
  if (x == 0) return 1;
  if (fact[x] != 0) return fact[x];
  return fact[x] = (x * f(x - 1)) % MOD;
}
int main() {
  d[1] = 1;
  for (int i = 2; i < N; i++) {
    d[i] = (1ll * i * (f(i - 1) - 1 + d[i - 1])) % MOD;
  }
  int n;
  cin >> n;
  cout << d[n];
  return 0;
}
