source_code: //package round22;
  
  
  import java.io.PrintWriter;
  import java.io.StringReader;
  import java.util.Arrays;
  import java.util.Scanner;
  
  public class A {
  	private Scanner in;
  	private PrintWriter out;
  //	private String INPUT = "5 1 2 3 1 1";
  	private String INPUT = "";
  	
  	public void solve()
  	{
  		int n = ni();
  		int[] a = new int[n];
  		for(int i = 0;i < n;i++){
  			a[i] = ni();
  		}
  		Arrays.sort(a);
  		for(int i = 1;i < n;i++){
  			if(a[i] > a[i - 1]){
  				out.println(a[i]);
  				return;
  			}
  		}
  		out.println("NO");
  	}
  	
  	public void run() throws Exception
  	{
  		in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(new StringReader(INPUT));
  		out = new PrintWriter(System.out);
  		
  		solve();
  		out.flush();
  	}
  	
  	
  	public static void main(String[] args) throws Exception
  	{
  		new A().run();
  	}
  	
  	private int ni() { return Integer.parseInt(in.next()); }
  	private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); }
  }
  