#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const long long mod = 1000000007;
long long mpow(long long x, long long n) {
  long long ans = 1;
  while (n != 0) {
    if (n & 1) ans = ans * x % mod;
    x = x * x % mod;
    n = n >> 1;
  }
  return ans;
}
long long inv_mod(long long a) { return mpow(a, mod - 2); }
bool square(long long a) {
  long long n = (long long)sqrt(a);
  return a == n * n;
}
int digitsum(long long N, int a) {
  if (N == 0) return 0;
  int ret = 0;
  ret += digitsum(N / a, a) + N % a;
  return ret;
}
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; };
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
vector<long long> splitint(string n, int a) {
  int Len = n.length();
  if (a < 0 || Len < a) return {-1, -1};
  string left, right;
  if (a != 0) left = n.substr(0, a);
  if (a != Len) right = n.substr(a);
  return {stoll(left), stoll(right)};
}
class mint {
 private:
  long long _num, _mod;
  mint set(long long num) {
    _num = num;
    if (_num >= 0)
      _num %= _mod;
    else
      _num += (1 - (_num + 1) / _mod) * _mod;
    return *this;
  }
  long long imod(long long n) { return mpow(n, _mod - 2); }

 public:
  mint() {
    _num = 0;
    _mod = mod;
  }
  mint(long long num) {
    _mod = mod;
    _num = num % mod;
  }
  mint(long long num, long long M) {
    _mod = M;
    set(num);
  }
  mint(const mint &cp) {
    _num = cp._num;
    _mod = cp._mod;
  }
  mint operator=(long long x) { return mint(x % _mod, _mod); }
  mint operator+(long long x) { return mint(_num + (x % _mod), _mod); }
  mint operator-(long long x) { return mint(_num - (x % _mod), _mod); }
  mint operator*(long long x) { return mint(_num * (x % _mod), _mod); }
  mint operator/(long long x) { return mint(_num * imod(x), _mod); }
  mint operator+=(long long x) { return set(_num + (x % _mod)); }
  mint operator-=(long long x) { return set(_num - (x % _mod)); }
  mint operator*=(long long x) { return set(_num * (x % _mod)); }
  mint operator/=(long long x) { return set(_num * imod(x)); }
  mint operator+(mint x) { return mint(_num + x._num, _mod); }
  mint operator-(mint x) { return mint(_num - x._num, _mod); }
  mint operator*(mint x) { return mint(_num * x._num, _mod); }
  mint operator/(mint x) { return mint(_num * imod(x._num), _mod); }
  mint operator+=(mint x) { return set(_num + x._num); }
  mint operator-=(mint x) { return set(_num - x._num); }
  mint operator*=(mint x) { return set(_num * x._num); }
  mint operator/=(mint x) { return set(_num * imod(x._num)); }
  friend mint operator+(long long x, mint m) {
    return mint(m._num + (x % m._mod), m._mod);
  }
  friend mint operator-(long long x, mint m) {
    return mint(m._num - (x % m._mod), m._mod);
  }
  friend mint operator*(long long x, mint m) {
    return mint(m._num * (x % m._mod), m._mod);
  }
  friend mint operator/(long long x, mint m) {
    return mint(m.imod(m._num) * x, m._mod);
  }
  explicit operator long long() { return _num; }
  explicit operator int() { return _num; }
  friend ostream &operator<<(ostream &os, const mint &x) {
    os << x._num;
    return os;
  }
  friend istream &operator>>(istream &is, mint &x) {
    long long val;
    is >> val;
    x.set(val);
    return is;
  }
};
class UnionFind {
 private:
  vector<int> Parent;

 public:
  UnionFind(int N) {
    Parent.resize(N);
    for (int i = 0, i_len = (N); i < i_len; ++i) Parent[i] = -1;
  }
  int root(int A) {
    if (Parent[A] < 0)
      return A;
    else
      return Parent[A] = root(Parent[A]);
  }
  int size(int A) { return -Parent[root(A)]; }
  bool connect(int A, int B) {
    A = root(A);
    B = root(B);
    if (A == B) return false;
    if (size(A) < size(B)) swap(A, B);
    Parent[A] += Parent[B];
    Parent[B] = A;
    return true;
  }
};
class Factorial {
 private:
  vector<long long> fac;
  vector<long long> ifac;

 public:
  Factorial(long long N) {
    fac.push_back(1);
    for (int i = 0, i_len = (N); i < i_len; ++i)
      fac.push_back(fac[i] * (i + 1) % mod);
    ifac.resize(N + 1);
    ifac[N] = inv_mod(fac[N]);
    for (int i = 0, i_len = (N); i < i_len; ++i)
      ifac[N - 1 - i] = (ifac[N - i] * (N - i)) % mod;
  }
  long long fact(long long a) { return fac[a]; }
  long long ifact(long long a) { return ifac[a]; }
  long long cmb(long long a, long long b) {
    if (a == 0 && b == 0) return 1;
    if (a < b || a < 0 || b < 0) return 0;
    long long tmp = ifact(a - b) * ifact(b) % mod;
    return tmp * fac[a] % mod;
  }
  long long per(long long a, long long b) {
    if (a == 0 && b == 0) return 1;
    if (a < b || a < 0 || b < 0) return 0;
    return fac[a] * ifac[a - b] % mod;
  }
};
class SOSU {
 private:
  vector<long long> Prime_Number;

 public:
  SOSU(int N) {
    set<long long> arr;
    for (int i = 0, i_len = (N - 1); i < i_len; ++i) arr.insert(i + 2);
    while (int n = *arr.begin()) {
      if (n > sqrt(N)) break;
      Prime_Number.push_back(n);
      for (int i = int(1); i < int(N / n + 1); ++i) arr.erase(n * i);
    }
    for (auto itr = (arr).begin(); itr != (arr).end(); ++itr)
      Prime_Number.push_back(*itr);
  }
  long long operator[](int i) { return Prime_Number[i]; }
  int count() { return Prime_Number.size(); }
  bool isPrime(int q) {
    return binary_search((Prime_Number).begin(), (Prime_Number).end(), q);
  }
};
struct Solutions {
  long long napsack(int kinds, int MAX_W, vector<long long> weight,
                    vector<long long> cost) {
    vector<vector<long long>> dp(kinds + 1, vector<long long>(MAX_W + 1, 0));
    for (int i = 0, i_len = (kinds); i < i_len; ++i)
      for (int j = 0, j_len = (MAX_W + 1); j < j_len; ++j) {
        if (j < weight[i])
          dp[i + 1][j] = dp[i][j];
        else
          dp[i + 1][j] = max(dp[i][j], dp[i][j - weight[i]] + cost[i]);
      }
    return dp[kinds][MAX_W];
  }
  long long unlimited_napsack(int kinds, int MAX_W, vector<long long> weight,
                              vector<long long> cost) {
    vector<vector<long long>> dp(kinds + 1, vector<long long>(MAX_W + 1, 0));
    for (int i = 0, i_len = (kinds); i < i_len; ++i)
      for (int j = 0, j_len = (MAX_W + 1); j < j_len; ++j) {
        if (j < weight[i])
          dp[i + 1][j] = dp[i][j];
        else
          dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - weight[i]] + cost[i]);
      }
    return dp[kinds][MAX_W];
  }
  long long Partition_Func(int n, int k) {
    vector<vector<long long>> dp(k + 1, vector<long long>(n + 1, 0));
    dp[0][0] = 1;
    for (int i = int(1); i < int(k + 1); ++i)
      for (int j = 0, j_len = (n + 1); j < j_len; ++j) {
        if (j - i >= 0)
          dp[i][j] = (dp[i][j - i] + dp[i - 1][j]);
        else
          dp[i][j] = dp[i - 1][j];
      }
    return dp[k][n];
  }
  int LCS(string s, string t) {
    int n = s.length(), m = s.length();
    vector<vector<int>> dp(n + 1, vector<int>(m + 1));
    for (int i = 0, i_len = (n); i < i_len; ++i)
      for (int j = 0, j_len = (m); j < j_len; ++j) {
        if (s[i] == t[j])
          dp[i + 1][j + 1] = dp[i][j] + 1;
        else
          dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
      }
    return dp[n][m];
  }
  int LIS(vector<long long> a) {
    int n = a.size();
    long long INF = 1 << 28;
    vector<long long> dp(n + 1, INF);
    for (int i = 0, i_len = (n); i < i_len; ++i)
      *lower_bound((dp).begin(), (dp).end(), a[i]) = a[i];
    int k = lower_bound((dp).begin(), (dp).end(), INF) - dp.begin();
    return k;
  }
};
struct edge {
  int from;
  int to;
  long long cost;
  void push(int a, int b, int c) {
    from = a;
    to = b;
    cost = c;
  }
  bool operator<(const edge &y) const {
    if (cost != y.cost)
      return cost < y.cost;
    else if (to != y.to)
      return to < y.to;
    else
      return from < y.from;
  }
  bool operator>(const edge &y) const {
    if (cost != y.cost)
      return cost > y.cost;
    else if (to != y.to)
      return to > y.to;
    else
      return from > y.from;
  }
  bool operator==(const edge &y) const { return *this == y; }
};
class lca {
 public:
  const int n = 0;
  const int log2_n = 0;
  std::vector<std::vector<int>> parent;
  std::vector<int> depth;
  lca() {}
  lca(const Graph &g, int root)
      : n(g.size()),
        log2_n(log2(n) + 1),
        parent(log2_n, std::vector<int>(n)),
        depth(n) {
    dfs(g, root, -1, 0);
    for (int k = 0; k + 1 < log2_n; k++) {
      for (int v = 0; v < (int)g.size(); v++) {
        if (parent[k][v] < 0)
          parent[k + 1][v] = -1;
        else
          parent[k + 1][v] = parent[k][parent[k][v]];
      }
    }
  }
  void dfs(const Graph &g, int v, int p, int d) {
    parent[0][v] = p;
    depth[v] = d;
    for (int j = 0, j_len = (g[v].size()); j < j_len; ++j) {
      if (g[v][j] != p) dfs(g, g[v][j], v, d + 1);
    }
  }
  int get(int u, int v) {
    if (depth[u] > depth[v]) std::swap(u, v);
    for (int k = 0; k < log2_n; k++) {
      if ((depth[v] - depth[u]) >> k & 1) {
        v = parent[k][v];
      }
    }
    if (u == v) return u;
    for (int k = log2_n - 1; k >= 0; k--) {
      if (parent[k][u] != parent[k][v]) {
        u = parent[k][u];
        v = parent[k][v];
      }
    }
    return parent[0][u];
  }
};
bool Xor(int a, int b, int c) {
  while (a > 0 || b > 0 || c > 0) {
    int bita = a % 2, bitb = b % 2, bitc = c % 2;
    if (bita ^ bitb != bitc) return false;
    a /= 2;
    b /= 2;
    c /= 2;
  }
  return true;
}
int main() {
  int N;
  cin >> N;
  vector<long long> x(N);
  for (int i = 0, i_len = (N); i < i_len; ++i) cin >> x[i];
  bool ok = true;
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    if (i == 0) {
      if (!Xor(x[N - 1], x[1], x[0])) {
        ok = false;
        break;
      }
    } else if (i == N - 1) {
      if (!Xor(x[0], x[N - 2], x[N - 1])) {
        ok = false;
        break;
      }
    } else {
      if (!Xor(x[i - 1], x[i + 1], x[i])) {
        ok = false;
        break;
      }
    }
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
