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