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