#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long long a[1000010];
int main() {
  int n;
  cin >> n;
  if (n == 1 || n == 2) {
    cout << n;
    return 0;
  }
  a[n] = n;
  for (long long i = n - 1; i >= 1; i--) a[i] = a[i + 1] * i % mod;
  long long ans = a[1] * (n - 1) % mod;
  for (int i = n; i >= 3; i--) ans = (ans - a[i]) % mod;
  cout << (ans % mod + mod) % mod;
}
