#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size() - 1; i++) {
    if (v[i] < v[i + 1]) {
      cout << v[i + 1] << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
