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