#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
typedef vector<vector<int> > VVI;
inline int mult(int x, int y) { return ((long long)x * y) % 1000000007; }
int power(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = mult(ret, x);
    x = mult(x, x);
    y = y / 2;
  }
  return ret;
}
int gcd(int a, int b) {
  if (b) return gcd(b, a % b);
  return a;
}
vector<int> prime;
void generateprime(int n) {
  int i, j;
  vector<int> num(n + 5);
  num[1] = 1;
  for (i = 4; i < n; i = i + 2) num[i] = 1;
  for (i = 3; i < n; i++) {
    if (num[i] == 0) {
      for (j = 3 * i; j < n; j = j + 2 * i) num[j] = 1;
    }
  }
  num[0] = 0;
  for (i = 2; i < n; i++) {
    if (num[i] == 0) prime.push_back(i);
    num.clear();
  }
}
int main() {
  int count1, n, i, temp;
  scanf("%d", &n);
  if (n == 1) {
    scanf("%d", &temp);
    if (temp == 1) printf("YES\n");
    if (temp == 0) printf("NO\n");
  } else {
    count1 = 0;
    for (i = 0; i < n; i++) {
      scanf("%d", &temp);
      if (temp == 1) count1++;
    }
    if (count1 == n - 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
