#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  fast();
  long long n;
  cin >> n;
  long long arr[2] = {0};
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    arr[x]++;
  }
  if ((n == 1 && arr[1] == 1) || (n > 1 && arr[1] == n - 1))
    cout << "YES";
  else
    cout << "NO";
}
