#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a),i##Len_=(b);i<i##Len_;i++)
typedef int ll;
//static const ll MOD = 1000000007;
//static const ll INF = 1000000000000000000LL;



int main()
{
    ll N;
    cin >> N;

    ll bit[N+2] = {};

    string res = "Yes";

    REP(i,N)
    {
        cin >> bit[i];
    }

    bit[N] = bit[0];
    bit[N+1] = bit[1];

    ll tmp;

    for(ll i = 1; i <= N; ++i)
    {

        tmp = bit[i-1]^bit[i+1];

        if(bit[i] != tmp)
        {  
            res = "No";
            break;
        }
    }

    cout << res << endl;
    return 0;
}

