#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 9;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = (long long)(0); i < (long long)(n); ++i) cin >> v[i];
  sort(v.begin(), v.end());
  for (long long i = (long long)(0); i < (long long)(n); ++i) {
    if (v[i] != v[0]) {
      cout << v[i];
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
