#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int val;
  set<int> arr;
  for (int i = 0; i < n; ++i) {
    cin >> val;
    arr.insert(val);
  }
  auto it = next(arr.begin());
  if (arr.size() == 1)
    cout << "NO" << endl;
  else {
    cout << *it << endl;
  }
  return 0;
}
