#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, s = 101, m = 0, t = 101;
  cin >> n;
  cin >> m;
  if (n > 1) cin >> t;
  if (t < m) {
    s = t;
    int h = 0;
    h = s;
    s = m;
    m = h;
  } else if (t > m) {
    s = t;
  }
  for (int i = 0; i < n - 2; i++) {
    int h = 0;
    cin >> h;
    if (h < m) {
      s = m;
      m = h;
    } else if (h < s && h > m)
      s = h;
  }
  if (s != 101)
    cout << s << endl;
  else
    cout << "NO" << endl;
  return 0;
}
