#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, c = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (!x && !c)
      c = 1;
    else if (c == 1 && !x)
      c = 2;
  }
  if (n == 1) {
    if (x)
      printf("YES\n");
    else
      printf("NO\n");
  } else {
    if (c == 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
