#include <bits/stdc++.h>
using namespace std;
int main() {
  set<int> s;
  int n, temp;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    s.insert(temp);
  }
  set<int>::iterator it = s.begin();
  it++;
  if (it != s.end())
    cout << *it << endl;
  else
    cout << "NO" << endl;
  return 0;
}
