#include <bits/stdc++.h>
using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;
template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  for (const auto& e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& st) {
  for (const auto& e : st) os << e << " ";
  return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const map<T1, T2>& mp) {
  for (const auto& e : mp) os << e << " ";
  return os;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  Int N;
  cin >> N;
  map<Int, pair<Int, Int>> cnt;
  Int a;
  vector<Int> A(N);
  for (Int i = 0; i < N; i++) {
    cin >> a;
    A[i] = a;
    cnt[a].first++;
  }
  vector<Int> res(N);
  res[0] = a;
  cnt[a].second++;
  Int temp;
  Int flag = 0;
  for (Int i = 0; i < N - 1; i++) {
    temp = 0;
    for (Int j = 0; j <= 30; j++) {
      if (res[0] & (1LL << j)) {
        if (A[i] & (1LL << j)) {
          continue;
        } else {
          temp += (1LL << j);
        }
      } else {
        if (A[i] & (1LL << j)) {
          temp += (1LL << j);
        } else {
          continue;
        }
      }
    }
    auto itr = cnt.find(temp);
    if (itr != cnt.end()) {
      if (temp == A[i]) {
        if (cnt[temp].first < cnt[temp].second + 2) {
          continue;
        } else {
          cnt[temp].second++;
          cnt[A[i]].second++;
          res[1] = A[i];
          res[2] = temp;
          flag = 1;
          break;
        }
      } else {
        if (cnt[temp].first < cnt[temp].second + 1) {
          continue;
        } else {
          cnt[temp].second++;
          cnt[A[i]].second++;
          res[1] = A[i];
          res[2] = temp;
          flag = 1;
          break;
        }
      }
    }
  }
  if (!flag) {
    cout << "No"
         << "\n";
    return 0;
  }
  ((void)0);
  for (Int i = 3; i < N; i++) {
    temp = 0;
    for (Int j = 0; j <= 30; j++) {
      if (res[i - 2] & (1LL << j)) {
        if (res[i - 1] & (1LL << j)) {
          continue;
        } else {
          temp += (1LL << j);
        }
      } else {
        if (res[i - 1] & (1LL << j)) {
          temp += (1LL << j);
        } else {
          continue;
        }
      }
      auto itr = cnt.find(temp);
      if (itr != cnt.end()) {
        if (cnt[temp].first < cnt[temp].second + 1) {
          cout << "No"
               << "\n";
          return 0;
        } else {
          cnt[temp].second++;
          res[i] = temp;
        }
      } else {
        cout << "No"
             << "\n";
        return 0;
      }
    }
  }
  temp = 0;
  for (Int j = 0; j <= 30; j++) {
    if (res[N - 2] & (1LL << j)) {
      if (res[N - 1] & (1LL << j)) {
        continue;
      } else {
        temp += (1LL << j);
      }
    } else {
      if (res[N - 1] & (1LL << j)) {
        temp += (1LL << j);
      } else {
        continue;
      }
    }
  }
  if (temp == res[0]) {
    cout << "Yes"
         << "\n";
  } else {
    cout << "No"
         << "\n";
  }
}
