#include <bits/stdc++.h>
int main() {
  int64_t n;
  std::cin >> n;
  int x[n];
  for (int i = 1; i <= n; i++) std::cin >> x[i];
  std::sort(x + 1, x + n + 1);
  for (int i = 1; i <= n; i++)
    if (x[i] != x[1]) {
      std::cout << x[i] << "\n";
      return 0;
    }
  std::cout << "NO"
            << "\n";
}
