func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2001000, mod = 998244353;   int n, a[N], b[N], f[N], ans, sum, inv[N];   void Init() {     f[0] = inv[1] = 1;     f[1] = n;     for (int i = 2; i < N; ++i) {       inv[i] = mod - mod / i * (long long)inv[mod % i] % mod;       f[i] = (long long)f[i - 1] * (n - 1 + i) % mod * inv[i] % mod;     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     Init();     for (int i = 1; i <= n; ++i) {       cin >> a[i];       ++b[a[i]];     }     for (int i = 0, j = 0; i < n; ++i) {       j += b[i];       if (j >= i + 2) {         cout << (ans + 1) % mod <<   n ;         return 0;       }       ans = (ans + f[i - j + 1]) % mod;     }     memset(b, 0, sizeof b);     ans = 0;     for (int i = 1; i <= n; ++i) sum += a[i] / n, b[a[i] % n]++;     for (int i = 0; i < n; ++i) {       ans = (ans + f[sum]) % mod;       sum -= b[i] - 1;     }     cout << ans <<   n ;     return 0;   }   