#include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int n, temp, sum1 = 0; cin >> n; vector v; for (int i = 0; i < n; i++){ cin >> temp; v.push_back(temp); } sort(v.begin(), v.end()); for (int i = 0; i < n-1; i++){ if (i == 0) sum1 += v[i]; if (v[i] != (v[i+1] - 1)) sum1 += v[i+1]; } cout << sum1 << endl; }