#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h, i, a, dem;
  cin >> n;
  i = 1;
  dem = 0;
  if (n == 1) {
    cin >> a;
    if (a == 1)
      cout << "YES";
    else if (a == 0)
      cout << "NO";
  } else {
    while (i <= n) {
      cin >> a;
      if (a == 0)
        dem = dem + 1;
      else if (a == 1)
        dem = dem + 0;
      i = i + 1;
    }
    if (dem == 1)
      cout << "YES";
    else
      cout << "NO";
  }
}
