#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, ans, check, c, k, j, cou, tf, ts, tt, tfc, tsc, ttc, si;
  vector<long long> a;
  cin >> N;
  for (long long(i) = 0; (i) < (N); (i)++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  if (N % 3 == 0) {
    check = 0;
    for (long long(i) = 0; (i) < (N); (i)++) {
      if (a[i] == 0) {
        check = check + 1;
      }
    }
    if (check == 0) {
      tf = a[0];
      ts = -1;
      tt = -1;
      for (long long(i) = 0; (i) < (N); (i)++) {
        if (a[i] != tf) {
          ts = a[i];
        }
        if (ts != -1) break;
      }
      for (long long(i) = 0; (i) < (N); (i)++) {
        if (a[i] != ts && a[i] != tf) {
          tt = a[i];
        }
        if (tt != -1) break;
      }
      tfc = 0;
      tsc = 0;
      ttc = 0;
      k = 0;
      for (long long(i) = 0; (i) < (N); (i)++) {
        if (a[i] == tf) {
          tfc = tfc + 1;
        };
        if (a[i] == ts) {
          tsc = tsc + 1;
        };
        if (a[i] == tt) {
          ttc = ttc + 1;
        };
      }
      if (ttc * 3 == N && tsc * 3 == N && tfc * 3 == N) {
        si = tf ^ ts;
        if (si == tt) {
          cout << "Yes" << endl;
        } else {
          cout << "No" << endl;
        }
      } else {
        cout << "No" << endl;
      }
    } else {
      if (check == N) {
        cout << "Yes" << endl;
      } else {
        if (check * 3 == N) {
          c = 2;
          while (c > 1) {
            j = 0;
            if (a[j] != 0) {
              k = a[j];
              c = 0;
            }
            j = j + 1;
          }
          cou = 0;
          for (long long(i) = 0; (i) < (N); (i)++) {
            if (a[i] == 0 || a[i] == k) {
              cou = cou + 1;
            }
          }
          if (cou == N) {
            cout << "Yes" << endl;
          } else {
            cout << "No" << endl;
          }
        } else {
          cout << "No" << endl;
        }
      }
    }
  } else {
    check = 0;
    for (long long(i) = 0; (i) < (N); (i)++) {
      if (a[i] != 0) {
        check = 1;
      }
    }
    if (check == 1) {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
  return 0;
}
