#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
int b[1010], s, h[101005];
int main() {
  ios::sync_with_stdio(0);
  int a[1010], n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) {
    if (a[i] != a[1]) {
      b[++s] = a[i];
      cout << a[i];
      break;
    }
  }
  if (s < 1) cout << "NO";
  return 0;
}
