#include <bits/stdc++.h>
using namespace std;
const int infinity = 2000000999 / 2;
const long long int inff = 4000000000000000999;
template <class T>
T get() {
  T a;
  cin >> a;
  return a;
}
template <class T, class U>
ostream& operator<<(ostream& out, const pair<T, U>& par) {
  out << "[" << par.first << ";" << par.second << "]";
  return out;
}
template <class T>
ostream& operator<<(ostream& out, const set<T>& cont) {
  out << "{";
  for (const auto& x : cont) out << x << ", ";
  out << "}";
  return out;
}
template <class T, class U>
ostream& operator<<(ostream& out, const map<T, U>& cont) {
  out << "{";
  for (const auto& x : cont) out << x << ", ";
  out << "}";
  return out;
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i) out << " ";
    out << v[i];
  }
  out << endl;
  return out;
}
bool ccw(complex<long double> p, complex<long double> a,
         complex<long double> b) {
  if ((conj(a - p) * (b - p)).imag() <= 0)
    return false;
  else
    return true;
}
int main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  int n = get<int>();
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  long long int P = 998244353;
  vector<long long int> fact(n, 1);
  for (int i = n; i > 0; i--) {
    if (0)
      cout << "Fact[" << n - i << "] = " << (i != n ? fact[n - i - 1] : 1)
           << " * " << i << endl;
    fact[n - i] = ((i != n ? fact[n - i - 1] : 1) * i) % P;
  }
  if (0) cout << fact;
  long long int res = ((n - 1) * fact[n - 1]) % P;
  if (0) cout << "res pred " << res << endl;
  for (int i = 0; i < (int)n - 2; i++) {
    res = (res + P - fact[i]) % P;
  }
  cout << res << endl;
}
