#include <bits/stdc++.h>
using namespace std;
long i, k, i2, i1, r, k1, j, m, l, n, i3, j10, j2, j3, a1, a2, a3;
long cas, s, c, t1, a, b, k2, d, z, t, ng;
vector<long> ta;
int main() {
  scanf("%ld", &n);
  ta.clear();
  for (cas = 1; cas <= n; cas++) {
    scanf("%ld", &a);
    ta.push_back(a);
  }
  sort(ta.begin(), ta.end());
  a = ta[0];
  for (i = 1; i < n; i++) {
    if (ta[i] > a) {
      cout << ta[i] << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
  return 0;
}
