#include <bits/stdc++.h>
int a[100001];
int b[100001][30];
int max_count = 0;
void 2_sin(int i,int a_i)
{
	int count = 0;
	while(a_i != 0)
	{
		a_i = a_i /2 ;
		b[i][count] = a_i % 2;
		a_i = a_i / 2;
		count++;
		//if(count > max_count) max_count = count;
	}
}

int w(int N)
{
	int 1_num = 0;
	int 0_num = 0;
	int ans = 0;
	for(int i = 0; i < 30 ; i++)
	{
		for(int j = 0; j < N ; j++){
			if(b[j][i] == 0) 0_num++;
			else 1_num++;
		}
		if(1_num > 0){
			if(1_num == 0_num * 2)
			{
				ans  = 1;
			}
			else return 0;
		}
		else ans = 1;
		1_num = 0;
		0_num = 0;
	}
	if(ans == 1) return 1;
}

int main(void)
{
	int N;
	scanf("%d",N);
	int i = 0 ;
	for(i = 0; i < N; i++)
	{
		for(int j = 0; j < 100; j++)
		{
			b[i][j] = 0;
		}
	}
	for(i = 0; i < N; i++)
	{
		scanf("%d",a[i]);
		2_sin(i,a[i]);
	}
	a[i+1] = a[0];
	
	int ans = w(N);
	if(ans == 1)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}