func_code_string: #include <bits/stdc++.h>   using namespace std;   long long modexp(long long base, long long exp) {     if (exp == 1)       return base;     else if (exp == 0)       return 1;     else {       if (exp % 2 == 0) {         long long base1 = pow(modexp(base, exp / 2), 2);         if (base1 >= 1000000007)           return base1 % 1000000007;         else           return base1;       } else {         long long ans = (base * pow(modexp(base, (exp - 1) / 2), 2));         if (ans >= 1000000007)           return ans % 1000000007;         else           return ans;       }     }   }   long long gcd(long long a, long long b) {     if (!a) return b;     return gcd(b % a, a);   }   map<int, int> d;   set<int> s;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     int a[n];     for (long long i = 0; i < n; ++i) cin >> a[i];     for (long long i = 0; i < n; ++i) d[a[i]]++;     long long ans = 0;     for (long long i = 0; i < n; ++i) {       d[a[i]]--;       if (!d[a[i]]) {         d.erase(a[i]);       }       if (s.find(a[i]) == s.end()) {         ans += d.size();         s.insert(a[i]);       }     }     cout << ans;     return 0;   }   