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
#include <bits/stdc++.h>
using namespace std;
int maxint = numeric_limits<int>::max();
bool sortbysec(const pair<int, int>& a, const pair<int, int>& b) {
  return (a.second < b.second);
}
long long bino(int n, int m) {
  long long j = 1;
  for (int i = 0; i < m; i++) j = j * (n - i) / (i + 1);
  return j;
}
long long int fast_power(long long int a, long long int x) {
  if (x == 0)
    return 1;
  else if (x == 1)
    return a;
  else {
    long long int R = fast_power(a, x >> 1);
    if (!(x & 1))
      return R * R;
    else
      return R * a * R;
  }
}
bool cmp(pair<char, long long int>& a, pair<char, long long int>& b) {
  return a.second > b.second;
}
long double distance1(long long int x1, long long int y1, long long int x2,
                      long long int y2) {
  return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2) * 1.0);
}
const int N = 1e6 + 5;
long long int binpow(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
void solve() {
  long long int n, one = 0;
  cin >> n;
  if (n == 1) {
    long long int x;
    cin >> x;
    if (x == 0)
      cout << "NO";
    else
      cout << "YES";
    return;
  }
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    if (x == 1) one++;
  }
  if (n - one == 1) {
    cout << "YES";
  } else
    cout << "NO";
}
int main() {
  ios_base::sync_with_stdio(false);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
