#include <bits/stdc++.h>

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>//用tree

using namespace __gnu_pbds;

using namespace std;
typedef long long ll;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
typedef pair<int, int> pii;

const int mn = 1e6 + 5;
const int mod = 998244353;

int n;
int a[mn];

bool judge() {
    a[0] = a[n], a[n + 1] = a[1];
    for (int i = 1; i <= n; i++) if ((a[i - 1] ^ a[i + 1]) != a[i]) return 0;
    return 1;
}

int main() {
#ifdef trote
    freopen("../1.txt", "r", stdin);
#endif
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    if (judge()) puts("YES");
    else puts("NO");
    return 0;
}