#include <bits/stdc++.h>
using namespace std;
template <typename T>
void printV(vector<T> v) {
  for (int i = 0; i < v.size(); ++i) {
    cout << v[i] << " ";
  }
  cout << endl;
}
long long F[1000001];
int main() {
  long long n = 0;
  cin >> n;
  F[1] = 1;
  long long fact = 1;
  for (int i = 2; i <= n; ++i) {
    fact *= i;
    fact %= 998244353;
    F[i] = (i * F[i - 1]) % 998244353;
    F[i] += fact;
    F[i] -= i;
    F[i] %= 998244353;
    if (F[i] < 0) {
      F[i] += 998244353;
    }
  }
  cout << F[n] << endl;
  return 0;
}
