#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    int n, i, val;
    vector<int> v;
    cin >> n;
    for (i < 0; i < n; i++) {
      cin >> val;
      v.push_back(val);
    }
    sort((v).begin(), (v).end());
    i = 0;
    if (n <= 1)
      cout << "NO";
    else {
      while (i != n - 1 && v[i] == v[i + 1]) i++;
      if (i != n - 1)
        cout << v[i + 1];
      else
        cout << "NO";
    }
  }
  return 0;
}
