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.io.*;
import java.util.*;

/**
 * @author Alexander Tsupko (alexander.tsupko@outlook.com) (c) All rights reserved. July 13, 2016.
 */
public class A {
    private static class Solve {
        // instance variables

        private void solve(int testNumber, InputReader in, OutputWriter out) {
            boolean ans;

            int n = in.readInt();
            if (n != 1) {
                int counter = 0;
                for (int i = 0; i < n; i++) {
                    if (in.readInt() == 0) {
                        counter++;
                    }
                }
                ans = counter == 1;
            } else {
                ans = in.readInt() == 1;
            }

            out.println(ans ? "YES" : "NO");
        }

        // instance methods
    }

    /**
     private static class InputReader {
     private BufferedReader bufferedReader;
     private StringTokenizer stringTokenizer;

     private InputReader(InputStream inputStream) {
     bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
     }

     private void close() throws IOException {
     bufferedReader.close();
     }

     private String nextLine() {
     try {
     return bufferedReader.readLine();
     } catch (IOException e) {
     throw new RuntimeException(e);
     }
     }

     private String next() {
     while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
     stringTokenizer = new StringTokenizer(nextLine());
     }
     return stringTokenizer.nextToken();
     }

     private byte nextByte() {
     return Byte.parseByte(next());
     }

     private short nextShort() {
     return Short.parseShort(next());
     }

     private int nextInt() {
     return Integer.parseInt(next());
     }

     private long nextLong() {
     return Long.parseLong(next());
     }

     private float nextFloat() {
     return Float.parseFloat(next());
     }

     private double nextDouble() {
     return Double.parseDouble(next());
     }

     private boolean nextBoolean() {
     return Boolean.parseBoolean(next());
     }

     private char nextChar() {
     return next().charAt(0);
     }
     }
     */


    private static class InputReader {
        private InputStream inputStream;
        private byte[] buffer = new byte[1024];
        private int currentCharacter;
        private int numberOfCharacters;
        private InputReader.SpaceCharacterFilter spaceCharacterFilter;

        private InputReader(InputStream inputStream) {
            this.inputStream = inputStream;
        }

        private interface SpaceCharacterFilter {
            boolean isSpaceCharacter(int character);
        }

        private boolean isSpaceCharacter(int character) {
            if (spaceCharacterFilter != null) {
                return spaceCharacterFilter.isSpaceCharacter(character);
            }
            return character == ' ' || character == '\n' || character == '\r'
                    || character == '\t' || character == -1;
        }

        private void close() throws IOException {
            inputStream.close();
        }

        private int read() {
            if (numberOfCharacters == -1) {
                throw new InputMismatchException();
            }
            if (currentCharacter >= numberOfCharacters) {
                currentCharacter = 0;
                try {
                    numberOfCharacters = inputStream.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numberOfCharacters <= 0) {
                    return -1;
                }
            }
            return buffer[currentCharacter++];
        }

        private char readCharacter() {
            int character = read();
            while (isSpaceCharacter(character)) {
                character = read();
            }
            return (char) (character & 0xff);
        }

//        private char readCharacter() {
//            int character = read();
//            while (isSpaceCharacter(character)) {
//                character = read();
//            }
//            char result = '0';
//            do {
//                if (Character.isValidCodePoint(character)) {
//                    result = (char) (character & 0xff);
//                    break;
//                }
//            } while (!isSpaceCharacter(character));
//            return result;
//        }

        private String readString() {
            int character = read();
            while (isSpaceCharacter(character)) {
                character = read();
            }
            StringBuilder stringBuilder = new StringBuilder();
            do {
                if (Character.isValidCodePoint(character)) {
                    stringBuilder.appendCodePoint(character);
                }
                character = read();
            } while (!isSpaceCharacter(character));
            return stringBuilder.toString();
        }

        private int readInt() {
            int character = read();
            while (isSpaceCharacter(character)) {
                character = read();
            }
            int signum = 1;
            if (character == '-') {
                signum = -1;
                character = read();
            }
            int result = 0;
            do {
                if (character < '0' || character > '9') {
                    throw new InputMismatchException();
                }
                result *= 10;
                result += character - '0';
                character = read();
            } while (!isSpaceCharacter(character));
            return signum * result;
        }

        private long readLong() {
            int character = read();
            while (isSpaceCharacter(character)) {
                character = read();
            }
            int signum = 1;
            if (character == '-') {
                signum = -1;
                character = read();
            }
            long result = 0L;
            do {
                if (character < '0' || character > '9') {
                    throw new InputMismatchException();
                }
                result *= 10;
                result += character - '0';
                character = read();
            } while (!isSpaceCharacter(character));
            return signum * result;
        }

        private double readDouble() {
            int character = read();
            while (isSpaceCharacter(character)) {
                character = read();
            }
            int signum = 1;
            if (character == '-') {
                signum = -1;
                character = read();
            }
            double result = 0;
            while (!isSpaceCharacter(character) && character != '.') {
                if (character == 'e' || character == 'E') {
                    return result * Math.pow(10, readInt());
                }
                if (character < '0' || character > '9') {
                    throw new InputMismatchException();
                }
                result *= 10;
                result += character - '0';
                character = read();
            }
            if (character == '.') {
                character = read();
                double fraction = 1;
                while (!isSpaceCharacter(character)) {
                    if (character == 'e' || character == 'E') {
                        return result * Math.pow(10, readInt());
                    }
                    if (character < '0' || character > '9') {
                        throw new InputMismatchException();
                    }
                    fraction /= 10;
                    result += (character - '0') * fraction;
                    character = read();
                }
            }
            return signum * result;
        }
    }

    /**
     private static class InputReader {
     private static final int EOF = -1;

     private BufferedInputStream bufferedInputStream;
     private int buffer;
     private int n;

     private InputReader(InputStream inputStream) {
     bufferedInputStream = new BufferedInputStream(inputStream);
     fillBuffer();
     }

     private void fillBuffer() {
     try {
     buffer = bufferedInputStream.read();
     n = 8;
     } catch (IOException e) {
     System.err.println("EOF");
     buffer = EOF;
     n = -1;
     }
     }

     private boolean isNull() {
     return bufferedInputStream == null;
     }

     private boolean isEmpty() {
     return buffer == EOF;
     }

     private void close() throws IOException {
     bufferedInputStream.close();
     }

     private boolean readBoolean() {
     if (isEmpty()) {
     throw new RuntimeException("Reading from empty input stream");
     }
     n--;
     boolean bit = ((buffer >> n) & 1) == 1;
     if (n == 0) fillBuffer();
     return bit;
     }

     private char readCharacter() {
     if (isEmpty()) {
     throw new RuntimeException("Reading from empty input stream");
     }
     if (n == 8) {
     int character = buffer;
     fillBuffer();
     return (char) (character & 0xff);
     }
     int character = buffer;
     character <<= (8 - n);
     int oldN = n;
     fillBuffer();
     if (isEmpty()) {
     throw new RuntimeException("Reading from empty input stream");
     }
     n = oldN;
     character |= (buffer >>> n);
     return (char) (character & 0xff);
     }

     private int readInt() {
     int result = 0;
     for (int i = 0; i < 4; i++) {
     char character = readCharacter();
     result <<= 8;
     result |= character;
     }
     return result;
     }
     }
     */

    private static class OutputWriter {
        private final PrintWriter printWriter;

        private OutputWriter(OutputStream outputStream) {
            printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        private void close() {
            printWriter.close();
        }

        private void print(Object... objects) {
            int n = objects.length;
            for (int i = 0; i < n; i++) {
                if (i != 0) {
                    printWriter.print(' ');
                }
                printWriter.print(objects[i]);
            }
        }

        private void println(Object... objects) {
            print(objects);
            printWriter.println();
        }
    }

    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Solve solve = new Solve();

//        long start = System.nanoTime();

        solve.solve(1, in, out);
//        int testCount = Integer.parseInt(in.next());
//        for (int i = 1; i <= testCount; i++) {
//            solve.solve(i, in, out);
//        }

//        System.out.printf(Locale.US, "%.1f ms\n", (System.nanoTime()-start)/1e6);

        in.close();
        out.close();
    }
}
