#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ns[n];
  for (int i = 0; i < n; i++) cin >> ns[i];
  sort(ns, ns + n);
  int keeper = 1;
  bool printed = 0;
  for (int i = 1; i < n; i++) {
    if (ns[i] != ns[i - 1]) {
      cout << ns[i] << endl;
      printed = 1;
      break;
    }
  }
  if (!printed) cout << "NO" << endl;
}
