#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  set<int> x;
  int aa;
  cin >> aa;
  int y;
  while (aa--) {
    cin >> y;
    x.insert(y);
  }
  if (x.size() == 1)
    cout << "NO" << endl;
  else
    cout << *(++x.begin()) << endl;
}
