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