#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  if (n == 1) {
    cout << "NO";
    return 0;
  }
  int k = a[0], j;
  for (int i = 0; i < n; ++i) {
    if (k > a[i]) {
      j = i;
      k = a[i];
    }
  }
  int m = 400;
  for (int i = 0; i < n; ++i) {
    if (m > a[i] && a[i] != k) {
      m = a[i];
    }
  }
  if (m == 400) {
    cout << "NO";
    return 0;
  }
  cout << m;
  return 0;
}
