#include <bits/stdc++.h>
namespace AtCoder {
using Input = std::vector<std::string>;
using Num = std::vector<int>;
Input input(void) {
  Input result;
  {
    std::string buf = "", row = "";
    std::getline(std::cin, buf);
    for (unsigned int i = 0; i < buf.size(); i++) {
      if (' ' == buf[i]) {
        result.push_back(row);
        row = "";
      } else {
        row += buf[i];
      }
    }
    result.push_back(row);
  }
  return result;
}
Num replaceToInteger(Input original = {""}) {
  Num result;
  for (unsigned int i = 0; i < original.size(); i++) {
    result.push_back(atoi(original[i].c_str()));
  }
  return result;
}
}  // namespace AtCoder
namespace Atcoder {
class circle {
 private:
  std::vector<int> circleBuf;
  unsigned int allCombinationPosi;
  unsigned int allCombinationPosj;
  unsigned int allCombCounter;
  unsigned int size;
  unsigned int maxComb;

 public:
  circle(std::vector<int>);
  bool makeUpAnAllCombination(void);
  std::vector<int> getAtcoder(void);
};
Atcoder::circle::circle(std::vector<int> vec) {
  this->circleBuf = vec;
  this->size = this->circleBuf.size();
  this->allCombinationPosi = 0;
  this->allCombinationPosj = this->size == 1 ? 0 : 1;
  this->allCombCounter = 0;
  this->maxComb = this->size;
  for (unsigned int i = 2; i < this->size; i++) {
    this->maxComb *= i;
  }
}
bool Atcoder::circle::makeUpAnAllCombination(void) {
  unsigned int i = this->allCombinationPosi;
  unsigned int j = this->allCombinationPosj;
  int swapBuf = this->circleBuf[i];
  this->circleBuf[i] = this->circleBuf[j];
  this->circleBuf[j] = swapBuf;
  if (++j == this->size) {
    if (++i == (this->size - 1)) {
      this->allCombinationPosi = 0;
      this->allCombinationPosj = 1;
    } else {
      this->allCombinationPosi++;
      this->allCombinationPosj = this->allCombinationPosi + 1;
    }
  } else {
    this->allCombinationPosj++;
  }
  this->allCombCounter++;
  if (this->allCombCounter == this->maxComb) {
    return false;
  } else {
    return true;
  }
}
std::vector<int> Atcoder::circle::getAtcoder(void) { return this->circleBuf; }
}  // namespace Atcoder
int main(void) {
  AtCoder::Num s = AtCoder::replaceToInteger(AtCoder::input());
  const int n = s[0];
  Atcoder::circle* C =
      new Atcoder::circle(AtCoder::replaceToInteger(AtCoder::input()));
  bool f = true, ans = false;
  while (f) {
    int buf = 0;
    for (int i = 0; i < n; i++) {
      if (0 == i) {
        buf +=
            C->getAtcoder()[(n - 1)] ^ C->getAtcoder()[0] ^ C->getAtcoder()[1];
      } else if ((n - 1) == i) {
        buf +=
            C->getAtcoder()[(i - 1)] ^ C->getAtcoder()[i] ^ C->getAtcoder()[0];
      } else {
        buf += C->getAtcoder()[(i - 1)] ^ C->getAtcoder()[i] ^
               C->getAtcoder()[(i + 1)];
      }
      if (0 != buf) {
        f = false;
        ans = false;
        break;
      }
    }
    if (0 == buf) {
      ans = true;
      f = false;
      break;
    }
    if (!f) {
      break;
    }
    f = C->makeUpAnAllCombination();
  }
  if (ans) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  delete (C);
  return 0;
}
