int main(){                                                                                          
    int N;                                                                                           
    //int base;                                                                                      
                                                                                                     
    scanf("%d", &N);                                                                                 
                                                                                                     
    int decimal[N];                                                                                  
    //int binary[N];                                                                                 
                                                                                                     
    for(int i = 0; i < N; i++){                                                                      
//      base = 1;                                                                                    
//      binary[i] = 0;                                                                               
        scanf("%d", &decimal[i]);                                                                    
        /*                                                                                           
        while(decimal > 0){                                                                          
            binary[i] = binary[i] + (decimal[i] % 2);                                                
            decimal[i] = decimal[i] /2;                                                              
            base = base * 10;                                                                        
        }                                                                                            
        */                                                                                           
    }                                                                                                
                                                                                                     
    int j = 0;                                                                                       
    int result = 0;                                                                                  
    while(j < N){                                                                                    
        int left = j +1;                                                                             
        int right = j -1;                                                                            
        if(j == 0){                                                                                  
            right = N;                                                                               
        }else if(j == N){                                                                            
            left = 0;                                                                                
        }                                                                                            
                                                                                                     
        int xor = left ^ right;                                                                      
        if(xor == decimal[j]){                                                                       
            result = 1;                                                                              
        }                                                                                            
    }                                                                                                
                                                                                                     
    if(result == 1){                                                                                 
        printf("Yes");                                                                               
    }else{                                                                                           
        printf("No");                                                                                
    }                                                                                                
                                                                                                     
    return 0;                                                                                        
}    