#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int jlm = 0;
  int flag = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      jlm++;
    }
    if (jlm > 1) {
      flag = 0;
      break;
    }
  }
  if (flag == 0 || (n == 1 && jlm == 1) || (n != 1 && jlm == 0)) {
    printf("NO\n");
  } else {
    printf("YES\n");
  }
  return 0;
}
