#include <bits/stdc++.h>
long long R = 1, C = 1, H[2000010], N[2000010];
int hyouka(int a, int b) {
  if (C < b) return 1;
  if (C < a || b == 0) return 0;
  return N[H[a]] < N[H[b]] ? 1 : 0;
}
void hin(long long a) {
  int i = C++;
  for (N[H[0] = R] = a; hyouka(0, i / 2); i /= 2) H[i] = H[i / 2];
  H[i] = R++;
}
int hout() {
  int rt = H[1], i, j = 2, k = H[--C];
  for (i = 1; hyouka(i, C); i = j)
    H[i] = H[j = i * 2 + 1 - hyouka(i * 2, i * 2 + 1)];
  H[j / 2] = k;
  return rt;
}
int main() {
  long long n, i, a, c[100010], d[100010], r = 0, e[100010] = {1};
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &a);
    hin(a);
  }
  for (i = 0; i < n; i++) d[i] = N[hout()];
  c[r = 0] = d[0];
  r = 1;
  for (i = 1; i < n; i++) {
    if (d[i - 1] - d[i]) c[r++] = d[i];
    e[r - 1]++;
  }
  if (r == 1 && c[0] == 0) goto Yes;
  if (r == 3 && e[0] == e[1] && e[0] == e[2] && c[0] ^ c[1] == c[2]) goto Yes;
  if (r == 2 && e[0] * 2 == e[1] && c[0] == 0) goto Yes;
  goto END;
Yes:;
  printf("Yes\n");
  return 0;
END:;
  printf("No\n");
  return 0;
}
