#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, MOD = 1e9 + 7;
int n, m, a[N], b[N], x, y, ans, c, p, t, k, w, h, z, sum, mx, mn = 1e9;
string str;
char ch;
stack<string> st;
map<string, long long int> mp;
queue<string> q;
set<int> s;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n;
  while (n--) {
    cin >> x;
    s.insert(x);
  }
  set<int>::iterator it = s.begin();
  it++;
  (s.size() != 1) ? cout << *it : cout << "NO";
  return 0;
}
