#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c = 0, f = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    if (c == 2) {
      f = 1;
      cout << "NO" << endl;
      break;
    }
    int a;
    cin >> a;
    if (n == 1 && a == 0) {
      f = 1;
      cout << "NO" << endl;
      break;
    }
    if (n == 1 && a == 1) {
      f = 1;
      cout << "YES" << endl;
      break;
    }
    if (a == 0) {
      c++;
    }
  }
  if (c == 1) cout << "YES" << endl;
  if (c != 1 && f == 0) cout << "NO" << endl;
  return 0;
}
