#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  set<int> x;
  for (int i = 0; i < n; i++) {
    int m;
    cin >> m;
    x.insert(m);
  }
  int count = 0;
  if (x.size() == 1) cout << "NO" << endl;
  {}
  for (set<int>::iterator it = x.begin(); it != x.end(); it++) {
    if (count == 1) cout << (*it) << endl;
    count++;
  }
  return 0;
}
