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