#include #include #include using namespace std; int main() { int n; cin >> n; vector a(n); for(int& x : a) cin >> x; auto m1 = *min_element(a.begin(), a.end()); // NOTE: This removes all copies of m1, not just one. auto end = remove(a.begin(), a.end(), m1); auto m2 = *min_element(a.begin(), end); cout << m1 + m2 << endl; }