#include <bits/stdc++.h>
using namespace std;
bool isprime(long long n) {
  if (n < 2) return 0;
  if (n == 2) return 1;
  if (n % 2 == 0) return 0;
  for (long long i = 3; i * i <= n; i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
long long gccd(long long a, long long b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  return b ? gccd(b, a % b) : a;
}
void open() {}
void solve() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
char** create2DArray(int row, int col) {
  char** array2D = new char*[row];
  for (long long i = 0; i < row; ++i) array2D[i] = new char[col];
  return array2D;
}
int main() {
  open(), solve();
  int n, C0 = 0, C1 = 0;
  cin >> n;
  vector<int> v(n);
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
    if (v[i] == 0) C0++;
    if (v[i] == 1) C1++;
  }
  if (n == 1)
    cout << ((v[0] == 0) ? "NO" : "YES");
  else if (n > 1)
    cout << ((C0 != 1) ? "NO" : "YES");
}
