#include <bits/stdc++.h>
using namespace std;
struct Node {
  long int data;
  struct Node *next, *prev;
};
struct Node *createlist(int n) {
  struct Node *head = NULL, *temp;
  long int key, i = 1;
  while (i <= n) {
    struct Node *newnode = (struct Node *)malloc(sizeof(struct Node));
    newnode->next = NULL;
    newnode->prev = NULL;
    cin >> key;
    newnode->data = key;
    if (head == NULL) {
      head = newnode;
      temp = head;
    } else {
      temp->next = newnode;
      newnode->prev = temp;
      temp = newnode;
    }
    i++;
  }
  temp->next = head;
  head->prev = temp;
  return head;
}
int main() {
  int n, flag = 1;
  cin >> n;
  struct Node *head, *temp;
  head = createlist(n);
  temp = head->next;
  while (1) {
    if ((temp->next->data ^ temp->prev->data) != temp->data) flag = 0;
    if (temp == head || flag == 0) break;
    temp = temp->next;
  }
  if (flag == 0)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}
