func_code_string: #include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   const int imax = 2147483647;   const int imin = -2147483647;   const long long lmax = 9223372036854775807;   const long long lmin = -9223372036854775807;   long long power(long long a, long long b, long long m) {     long long p = 1;     while (b) {       if (b & 1) p = (p * a) % m;       b >>= 1;       a = (a * a) % m;     }     return (p % m);   }   int main() {     int n;     cin >> n;     int arr[100005];     int distinct[100005] = {0}, mp[100005] = {0};     for (int i = 0; i < n; i++) cin >> arr[i];     for (int i = n - 1; i >= 0; i--) {       if (i == n - 1) {         mp[arr[i]] = 1;         distinct[i] = 1;       } else {         if (mp[arr[i]] == 0) {           mp[arr[i]] = 1;           distinct[i] = 1 + distinct[i + 1];         } else           distinct[i] = distinct[i + 1];       }     }     memset(mp, 0, sizeof(mp));     long long ans = 0;     for (int i = 0; i < n - 1; i++) {       if (mp[arr[i]] == 0) {         mp[arr[i]] = 1;         ans += (long long)distinct[i + 1];       }     }     cout << ans;     return 0;   }   