#include <bits/stdc++.h>
using namespace std;
int a;
vector<int> ve;
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    ve.push_back(a);
  }
  sort(ve.begin(), ve.end());
  ve.erase(unique(ve.begin(), ve.end()), ve.end());
  if (ve.size() == 1)
    cout << "NO" << endl;
  else
    cout << ve[1] << endl;
}
