func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 2e5 + 5, inf = 998244353;   long long n, k, i;   long long A[N], B[N];   long long in[N], f[N];   inline long long expo(long long n, long long k, long long p = inf) {     long long r = 1;     for (; k; k >>= 1) {       if (k & 1) r = r * n % p;       n = n * n % p;     }     return r;   }   inline long long inv(long long a, long long p = inf) {     return expo(a, p - 2, p);   }   vector<long long> BIT(N);   void upd(long long first, long long val) {     for (; first <= n; first += (first & -first)) BIT[first] += val;   }   long long q(long long first) {     long long res = 0;     for (; first > 0; first -= (first & -first)) res += BIT[first];     return res;   }   long long m[N];   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long i, j, first, second, ans = 0, c = 0, a;     cin >> n;     for (i = 1; i < n + 1; i++) {       cin >> A[i];       if (A[i] != -1) {         m[A[i]] = 1;         ans += c - q(A[i] - 1);         upd(A[i], 1);         c++;       }     }     vector<long long> v;     for (i = 1; i < n + 1; i++)       if (!m[i]) v.emplace_back(i);     ans += 1LL * (long long)v.size() * ((long long)v.size() - 1) % inf * inv(4) %            inf;     long long t = 0;     c = 0;     for (i = 1; i < n + 1; i++) {       if (A[i] != -1) {         a = lower_bound(v.begin(), v.end(), A[i]) - v.begin();         ans +=             c * ((long long)v.size() - a) % inf * inv((long long)v.size()) % inf;         ans +=             a * ((long long)v.size() - c) % inf * inv((long long)v.size()) % inf;       } else         c++;     }     cout << ans % inf;   }   