<?php
$s = trim(fgets(STDIN));
$s = str_replace(array("\r\n","\r","\n"), '', $s);
$s = explode(" ", $s);

$N = $s[0];

$s = trim(fgets(STDIN));
$s = str_replace(array("\r\n","\r","\n"), '', $s);
$s = explode(" ", $s);

$a_list = $s;

$ret = "Yes";
for ($i = 0; $i < $N; $i++) {
    $a = (int)$a_list[$i];
    $before = (int)$a_list[($i-1+$N) % $N];
    $after = (int)$a_list[($i+1+$N) % $N];
    if ($a != ($before ^ $after)) {
        $ret = "No";
        break;
    }
}

echo $ret;
