func_code_string: #include <bits/stdc++.h>   using namespace std;   long long a[100001];   long long b[100001];   int main() {     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     map<int, int> cnt;     vector<int> q;     int loc = 0;     for (int i = n - 1; i >= 0; i--) {       cnt[a[i]]++;       if (cnt[a[i]] == 1) loc++;       b[i] = loc;     }     cnt.clear();     long long ans = 0;     for (int i = 0; i < n - 1; i++) {       cnt[a[i]]++;       if (cnt[a[i]] == 1) ans += b[i + 1];     }     cout << ans << endl;     return 0;   }   