#include <bits/stdc++.h>
using namespace std;
void answer() {
  int n;
  cin >> n;
  vector<int> v(n);
  set<int> s;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    s.insert(v[i]);
  }
  auto it = s.begin();
  (s.size() == 1) ? cout << "NO" : cout << *(++it);
}
int32_t main() {
  int t;
  t = 1;
  while (t--) {
    answer();
    cout << "\n";
  }
  return 0;
}
