#include <bits/stdc++.h>
using namespace std;
long long N;
int32_t main() {
  cin >> N;
  long long arr[N];
  arr[0] = 1;
  long long j = N;
  for (long long i = 0; i + 1 < N; i++) {
    arr[i + 1] = arr[i] * j;
    arr[i + 1] %= 998244353;
    j--;
  }
  long long ans = 0;
  for (long long i = 1; i < N; i++) {
    ans += (arr[i] - arr[i - 1] + 998244353) * i;
    ans %= 998244353;
  }
  cout << (ans + 1) % 998244353 << endl;
}
