#include <bits/stdc++.h>
using namespace std;
long long int n, f[1000007];
const long long int MOD = 998244353;
long long int fastpow(long long int x, long long int y) {
  if (y == 0) return 1;
  long long int recurse = fastpow(x, y / 2);
  if (y % 2 == 0) return (recurse * recurse) % MOD;
  return (x * (recurse * recurse) % MOD) % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  f[0] = 1;
  for (long long int i = 1; i <= n; ++i) {
    f[i] = (f[i - 1] * i) % MOD;
  }
  long long int ans = f[n], cur = n;
  for (long long int i = n - 1; i > 1; --i) {
    ans = (ans + cur * (f[i] - 1) % MOD) % MOD;
    cur = (cur * i) % MOD;
  }
  cout << ans << '\n';
  return 0;
}
