#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int k1, k2, k3;
int n;
bool fl = 0;
int main() {
  scanf("%d", &n);
  k1 = k2 = k3 = -1;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (k1 == -1)
      k1 = x;
    else if (x != k1) {
      if (k2 == -1)
        k2 = x;
      else if (x != k2) {
        if (k3 == -1)
          k3 = x;
        else if (k3 != x)
          fl = 1;
      }
    }
  }
  if (fl) return printf("No\n"), 0;
  if (k3 == -1 && k2 == -1) {
    if (k1 == 0)
      printf("Yes\n");
    else
      printf("No\n");
  } else if (k3 == -1) {
    if ((k1 == 0 || k2 == 0) && n % 3 == 0)
      printf("Yes\n");
    else
      printf("No\n");
  } else if (n % 3 == 0)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
