#include <bits/stdc++.h>
using namespace std;
const int inf = 1000 * 1000 * 1000;
int A[1000];
int main() {
  int n, a = inf, b = inf, c = inf;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b;
    a = min(a, b);
    A[i] = b;
  }
  for (int i = 0; i < n; i++) {
    b = A[i];
    if (b > a) c = min(c, b);
  }
  if (c == inf)
    cout << "NO";
  else
    cout << c;
  return 0;
}
