#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v;
  int c;
  for (int i = 0; i < n; i++) {
    cin >> c;
    v.push_back(c);
  }
  if (n == 1) {
    if (v[0] == 1) {
      cout << "YES";
      return 0;
    }
  }
  sort(v.begin(), v.end());
  if (v[0] == 0 && v[1] == 1) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
