#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, x;
  int first = INT_MAX;
  int second = INT_MAX;
  cin >> n;
  while (n--) {
    cin >> x;
    if (x == first || x == second) continue;
    if (x < first && x < second) {
      second = first;
      first = x;
    } else if (x < second) {
      second = x;
    }
  }
  if (second == INT_MAX) {
    cout << "NO" << endl;
  } else {
    cout << second << endl;
  }
}
