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