#include <bits/stdc++.h>
using namespace std;
int b[10000], a[10000];
int main() {
  int n, h = 0, j = 1, z, mini = 99999, minim = 9999;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] < mini) {
      mini = a[i];
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] > mini && a[i] < minim) {
      minim = a[i];
    }
  }
  if (minim == 9999) {
    cout << "NO";
  } else {
    cout << minim;
  }
}
