#include <bits/stdc++.h>
int main(void) {
  int N;
  std::cin >> N;
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) std::cin >> a[i];
  std::unordered_map<long long, int> k;
  for (int i = 0; i < N; i++) {
    if (k.count(a[i]) == 0)
      k[a[i]] = 1;
    else
      k[a[i]]++;
  }
  std::vector<int> S(N);
  for (int i = 0; i < N; i++) {
    if (S[i] == 1) continue;
    long long ok = -1;
    for (auto itr = k.begin(); itr != k.end(); ++itr) {
      if (itr->second == 0) itr = k.erase(itr);
      if (itr != k.end() && itr->second > 0) ok = itr->first;
    }
    if (ok == -1) {
      std::cout << "No" << std::endl;
      return 0;
    }
    S[i] = 1;
    if (S[(i + 3) % N] == 0) {
      if (k[ok] > 0) {
        S[(i + 3) % N] = 1;
        k[ok]--;
      } else {
        std::cout << "No" << std::endl;
        return 0;
      }
    }
    if (S[(i - 3 + N) % N] == 0) {
      if (k[ok] > 0) {
        S[(i - 3 + N) % N] = 1;
        k[ok]--;
      } else {
        std::cout << "No" << std::endl;
        return 0;
      }
    }
  }
  std::cout << "Yes" << std::endl;
  return 0;
}
