#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a = -1, b = -1, c = -1;
  int count = 0;
  for (int i = 0; i < n; i++) {
    int mid;
    cin >> mid;
    if (a == -1) {
      a = mid;
    } else if (b == -1 && mid != a) {
      b = mid;
    } else if (c == -1 && mid != b && mid != a) {
      c = mid;
    } else if (mid != a && mid != b && mid != c) {
      cout << "No" << endl;
      return 0;
    }
  }
  if (a == 0 && b == -1 && c == -1) {
    cout << "Yes" << endl;
    return 0;
  }
  if (a != -1 && b != -1 && c != -1 && n % 3 != 0) {
    cout << "No" << endl;
    return 0;
  }
  while (a != 0 || b != 0 || c != 0) {
    int a1 = a % 2;
    int b1 = b % 2;
    int c1 = c % 2;
    a = a / 2;
    b = b / 2;
    c = c / 2;
    if ((a1 == 0 && b1 == 1 && c1 == 1) || (a1 == 1 && b1 == 1 && c1 == 0) ||
        (a1 == 1 && b1 == 0 && c1 == 1) || (a1 == 0 && b1 == 0 && c1 == 0)) {
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}
