#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> mas;
  cin >> n;
  int tmp;
  for (int i = 0; i < n; ++i) {
    cin >> tmp;
    mas.push_back(tmp);
  }
  sort(mas.begin(), mas.end());
  tmp = mas[0];
  for (int i = 1; i < n; ++i) {
    if (mas[i] != tmp) {
      cout << mas[i];
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
