#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i, a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  i = 1;
  while (a[i] == a[0]) {
    i++;
  }
  if (i < n)
    cout << a[i];
  else
    cout << "NO";
  return 0;
}
