#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    bitset<10000> value;
    cin >> n;
    vector<int> a(n);
    vector<bool> flag(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int j = 1; j < n; j++) {
        bitset<10000> xor_bits = bitset<10000>(a[j-1]) ^ bitset<10000>(a[j+1]);
        if (xor_bits == bitset<100000>(a[j])) flag[j] = true;
        else flag[j] = false;
    }
    bitset<10000> xor_bits = bitset<10000>(a[1]) ^ bitset<10000>(a[n-1]);
    if (xor_bits == bitset<100000>(a[0])) flag[0] = true;
    else flag[0] = false;

    bool ans = false;
    for (int k = 0; k < n; k++) {
        if (flag[k] == false) {
            ans = true;
            if (ans) break;
        }
    }

    if (ans) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}