#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-10;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long double PI = 3.1415926535897932384626433832795028841;
map<string, int> ssol;
void checkAdd(string vs) {
  if (ssol.find(vs) != ssol.end()) {
    return;
  }
  ssol[vs] = 1;
}
bool TST = 0;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= MOD;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
  }
  return res;
}
void Show(int *QQ, int N) {
  if (not TST) {
    return;
  }
  for (int x = 0; x < N; x++) {
    cout << QQ[x];
    if (x != N - 1) {
      cout << ',';
    }
  }
  cout << '\n';
}
void ShowLL(long long *QQ, int N) {
  if (not TST) {
    return;
  }
  for (int x = 0; x < N; x++) {
    cout << QQ[x];
    if (x != N - 1) {
      cout << ',';
    }
  }
  cout << '\n';
}
const int maxn = 100005;
const int maxm = 100005;
const int maxk = 100005;
int main() {
  int n;
  cin >> n;
  int A[1005];
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  if (n == 1) {
    if (A[0] == 1) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
    return 0;
  }
  int s = 0;
  for (int i = 0; i < n; i++) {
    if (A[i] == 0) {
      s++;
    }
  }
  if (s == 1) {
    cout << "YES\n";
    return 0;
  }
  cout << "NO\n";
}

### Prompt

Develop a solution in Cpp to the problem described below:

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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-10;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long double PI = 3.1415926535897932384626433832795028841;
map<string, int> ssol;
void checkAdd(string vs) {
  if (ssol.find(vs) != ssol.end()) {
    return;
  }
  ssol[vs] = 1;
}
bool TST = 0;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= MOD;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
  }
  return res;
}
void Show(int *QQ, int N) {
  if (not TST) {
    return;
  }
  for (int x = 0; x < N; x++) {
    cout << QQ[x];
    if (x != N - 1) {
      cout << ',';
    }
  }
  cout << '\n';
}
void ShowLL(long long *QQ, int N) {
  if (not TST) {
    return;
  }
  for (int x = 0; x < N; x++) {
    cout << QQ[x];
    if (x != N - 1) {
      cout << ',';
    }
  }
  cout << '\n';
}
const int maxn = 100005;
const int maxm = 100005;
const int maxk = 100005;
int main() {
  int n;
  cin >> n;
  int A[1005];
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  if (n == 1) {
    if (A[0] == 1) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
    return 0;
  }
  int s = 0;
  for (int i = 0; i < n; i++) {
    if (A[i] == 0) {
      s++;
    }
  }
  if (s == 1) {
    cout << "YES\n";
    return 0;
  }
  cout << "NO\n";
}

```