#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  set<int> b;
  int a[n + 1];
  for (int k = 1; k <= n; k++) cin >> a[k];
  for (int k = 1; k <= n; k++) b.insert(a[k]);
  if (b.size() == 1) {
    cout << "NO";
    return 0;
  }
  set<int>::iterator it;
  it = b.begin();
  it++;
  cout << *it;
  return 0;
}
