#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N; cin>>N;
  vi A(60);
  rep(i,0,N){
    int X; cin>>X;
    bitset<60> B(X);
    rep(j,0,60){
      if(B.test(j)) A[j]++;
    }
  }
  string ans="No";
  if(N%3==0){
    ans="Yes";
    rep(i,0,60){
      if(A[j]!=0&&A[j]!=N*2/3){
        ans="No";
        break;
      }
    }
  }
  cout<<ans<<endl;
  }
