According to rules of the Berland fashion, a jacket should be fastened by all the buttons except only one, but not necessarily it should be the last one. Also if the jacket has only one button, it should be fastened, so the jacket will not swinging open.

You are given a jacket with n buttons. Determine if it is fastened in a right way.

Input

The first line contains integer n (1 ≤ n ≤ 1000) — the number of buttons on the jacket.

The second line contains n integers ai (0 ≤ ai ≤ 1). The number ai = 0 if the i-th button is not fastened. Otherwise ai = 1.

Output

In the only line print the word "YES" if the jacket is fastened in a right way. Otherwise print the word "NO".

Examples

Input

3
1 0 1


Output

YES


Input

3
1 0 0


Output

NO
import java.util.Scanner;

public class MI_PRIMER_PROBLEMA {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		/*Scanner sc= new Scanner(System.in);
		String palabra = sc.nextLine();
		String minuscula = palabra.toLowerCase();
		char letra = palabra.charAt(0);
		String letra2= (letra+"").toUpperCase();
		String minuscula_incompleta = minuscula.substring(1);
		System.out.println(letra2+minuscula_incompleta);*/
		
		 /*Scanner sc = new Scanner(System.in);
	        String  jugadores = sc.next();
	        if(jugadores.contains("1111111")||jugadores.contains("0000000"))
	            System.out.println("YES");
	        else
	            System.out.println("NO");*/
		
	        /*Scanner sc = new Scanner(System.in);
	    	String palabra = sc.nextLine(), palabra2 = sc.nextLine();
	    	String palabraUpdated = palabra.toLowerCase(), palabra2Updated = palabra2.toLowerCase();
	    	int value = 0;{
	    	for (int i = 0; i < palabraUpdated.length(); i++)
	    		if (palabraUpdated.charAt(i) == palabra2Updated.charAt(i))
	    			continue;
	    		else if (palabraUpdated.charAt(i) < palabra2Updated.charAt(i)) {
	    			value = -1;
	    			break;
	    		} else {
	    			value = 1;
	    			break;
	    		}
	    	System.out.println(value);
	    	sc.close();*/
    
		/*Scanner sc = new Scanner(System.in);
		System.out.println();
		String palabra = sc.nextLine();
		char letra = palabra.charAt(0);
		String letra2= (letra+"").toUpperCase();	
		String palabra2 = palabra.substring(1);
		System.out.println(letra2+palabra2);*/
		
		
		
		/*Scanner sc= new Scanner(System.in);
		System.out.println();
		String palabra = sc.nextLine();
		String minuscula = palabra.toLowerCase();
		for(int i=0; i < minuscula.length();i++){*/
		
		
		/*Scanner sc = new Scanner(System.in);
		String palabra = sc.nextLine();
		StringBuilder stringBuilder = new StringBuilder();
		for (int i = 0; i < palabra.length(); i++) {
			char consonante = palabra.charAt(i);
			if (isVowel(consonante))
				continue;
			else if (Character.isUpperCase(palabra.charAt(i)))
				stringBuilder.append(".").append(Character.toLowerCase(palabra.charAt(i)));
			else
				stringBuilder.append(".").append(palabra.charAt(i));
		}
		System.out.println(stringBuilder.toString());

		sc.close();

	}

	public static boolean isVowel(char consonante) {
		String vocales = "AOYEUIaoyeui";
		for (int i = 0; i < vocales.length(); i++)
			if (vocales.charAt(i) == consonante)
				return true;
		return false;

		
		}*/
			
	/*Scanner sc = new Scanner(System.in);
	System.out.println();
	int n = sc.nextInt();
	for(int i = 1; i <= n; i++){
		int numero = i % 2;
		if(numero == 1){
			System.out.print("I hate ");
	}else 
				System.out.print("I love ");
		if (i==n){
		System.out.print("it ");
	}else 
			System.out.print("that ");
				
	}*/
	
	/*Scanner sc= new Scanner(System.in);
	System.out.println();
	int n = sc.nextInt();
	String s = new String("");
	
	for(int i = 0; i < n-1; i++){
		if(i % 2 == 0) s = s + "I hate that ";
		if(i % 2 != 0) s = s + "I love that ";
	}
	if(n % 2 == 0) s = s + "I love it ";
	if(n % 2 != 0) s = s + "I hate it ";
	System.out.println(s);*/
	
		/*Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		StringBuilder palabra = new StringBuilder();
		if (n == 1) {
			System.out.println("I hate it");
			return;
		}
		for (int i = 1; i <= n; i++) {
			if (i == n) {
				if (i % 2 == 1)
					palabra.append("I hate it");
				else
					palabra.append("I love it");
			} else {
				if (i % 2 == 1)
					palabra.append("I hate that ");
				else
					palabra.append("I love that ");
			}
		}
		System.out.println(palabra.toString());	*/
		
		/*Scanner sc = new Scanner(System.in);
		String numero = sc.next();{
		if(numero.contains("1111111") || numero.contains("0000000")){
			System.out.println("YES");
		} else {
			System.out.println("NO");
			
		}
			
		}*/
		
		/*Scanner sc= new Scanner(System.in);
		String palabra = sc.next();	 
	   	palabra = palabra.replace("WUB"," ").trim();
	   	System.out.println(palabra);*/
		
		/*Scanner sc = new Scanner(System.in);
		String palabra = sc.nextLine();
		String minuscula = palabra.toLowerCase();
		char letra = minuscula.charAt(0);
		String letra2= (letra+"").toUpperCase();
		String minuscula2 = minuscula.substring(1);
		System.out.println(letra2+minuscula2);*/
		
		
		Scanner sc = new Scanner(System.in);
		int n;
		int d = 0; 
		n = sc.nextInt();
		for (int ai = 1; ai<=n;ai++){
			int b = sc.nextInt();
			if(b == 0){
				d = d +1;
			}	
		}

		if (n == 1){
			if (d == 0){
				System.out.println("YES");

			}
			else {
				System.out.println("NO");
			}

		}
		else{
			if (d == 1){
			System.out.println("YES");
			}
			else {
			System.out.println("NO");
			}
		}

}
}







