#include <bits/stdc++.h>
int cmp(const void *a, const void *b) { return (*(int *)a - *(int *)b); }
int main() {
  int n, i, min, flag;
  int s[100];
  while (scanf("%d", &n) != EOF) {
    flag = 0;
    for (i = 0; i < n; i++) scanf("%d", &s[i]);
    qsort(s, n, sizeof(s[0]), cmp);
    min = s[0];
    for (i = 1; i < n; i++) {
      if (s[i] > min) {
        flag++;
        printf("%d\n", s[i]);
        break;
      }
    }
    if (flag == 0) printf("NO\n");
  }
  return 0;
}
