#include <stdio.h>

typedef enum {false, true} bool;


int main(void)
{
    int N;
    bool ans = false;
    int a[3], ai;
    char c;
    int i;
    int index = 0;
    
    
    scanf("%d%c", &N, &c);
    
    scanf("%d%c", &a[0], &c);
    scanf("%d%c", &a[1], &c);
    scanf("%d%c", &a[2], &c);
    
    if(a[0]^a[2] == a[1] && a[1]^a[0] == a[2])
    {
        ans = true;
        
        for(i=3; i<N; i++)
        {
            scanf("%d%c", &ai, &c);
            
            if(ai != a[index++])
            {
                ans = false;
                break;
            }
            
            if(index == 3)
                index = 0;
        }
        
        if(N%3)
        {
            if(a[0] != a[1] || a[1] != a[2])
                ans == false;
        }
    }
    
    
    if(ans)
        printf("Yes\n");
    else
        printf("No\n");
    
    
    //system("pause");
    
    return 0;
}
