#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int num;     bool flag = true;     int* numbers = new int[n];     for (int i = 0; i < n; i++) {       cin >> num;       numbers[i] = num;       if (i == n - 1) break;     }     for (int i = 0; i < n - 1; i++)       for (int j = i + 1; j < n; j++) {         if (numbers[i] > numbers[j]) swap(numbers[i], numbers[j]);       }     int s;     if (n == 1)       flag = false;     else {       for (int i = 0; i < n; i++) {         if (numbers[i] > numbers[0]) {           flag = true;           s = numbers[i];           break;         }         flag = false;       }     }     if (flag)       cout << s << endl;     else       cout <<  NO ;     return 0;   }   