#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  unsigned int a[N];
  for (int i = 0; i < N; i++) cin >> a[i];
  if (N % 3) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 0; i < N; i++) {
  }
  cout << "Yes" << endl;
  return 0;
}
