#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long testcases = 1;
  while (testcases--) {
    long long n;
    cin >> n;
    set<long long> s1;
    for (long long i = 0; i < n; i++) {
      long long j;
      cin >> j;
      s1.insert(j);
    }
    if (s1.size() == 1) {
      cout << "NO";
    } else {
      auto it = s1.begin();
      it++;
      cout << *it;
    }
    cout << endl;
  }
  return 0;
}
