func_code_string: #include <bits/stdc++.h>   int dx[] = {0, 0, 1, -1, -1, -1, 1, 1};   int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};   template <class T>   inline T biton(T n, T pos) {     return n | ((T)1 << pos);   }   template <class T>   inline T bitoff(T n, T pos) {     return n & ~((T)1 << pos);   }   template <class T>   inline T ison(T n, T pos) {     return (bool)(n & ((T)1 << pos));   }   template <class T>   inline T gcd(T a, T b) {     while (b) {       a = a % b;       swap(a, b);     }     return a;   }   template <class T>   inline T bigmod(T p, T e, T m) {     T ret = 1;     for (; e > 0; e >>= 1) {       if (e & 1) ret = (ret * p) % m;       p = (p * p) % m;     }     return (T)ret;   }   using namespace std;   void solve() {     int n;     cin >> n;     vector<int> items;     for (int i = 0; i < n; i++) {       int item;       cin >> item;       items.push_back(item);     }     sort(items.rbegin(), items.rend());     set<long long> st;     long long cnt = 0;     for (int i = n - 1; i >= 0; i--) {       while (items[i]) {         if (st.count(items[i]) == 0) {           cnt += items[i];           st.insert(items[i]);           break;         }         items[i]--;       }     }     cout << cnt << endl;   }   int main() {     ios_base::sync_with_stdio(false);     cout.setf(ios::fixed);     cout.precision(10);     cout.tie(nullptr);     cin.tie(nullptr);     int t = 1;     while (t--) {       solve();     }     int pause;     cin >> pause;     return 0;   }   