#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, arr[100], j, k = 0;
  cin >> n;
  cin >> arr[0];
  int min = arr[0];
  for (int i = 1; i < n; i++) {
    cin >> arr[i];
    if (arr[i] < min) min = arr[i];
  }
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    if (arr[i] > min) {
      j = arr[i];
      k = 1;
      break;
    }
  }
  if (k)
    cout << j << endl;
  else
    cout << "NO" << endl;
  return 0;
}
