#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
const long long int mod = 998244353;
long long int d[1000000], x[1000000];
long long int sum = 0, n;
long long int fact(long long int n) {}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  d[1] = 1;
  d[2] = 2;
  x[1] = 1;
  for (long long int i = 2; i <= n; i++) {
    x[i] = (i % mod * x[i - 1] % mod) % mod;
  }
  for (long long int i = 3; i <= n; i++) {
    d[i] = ((d[i - 1] + x[i - 1] - 1) * i) % mod;
  }
  cout << d[n];
  return 0;
}
