#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<int,int> P;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000009;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}

int main(){
  int n;cin>>n;
  if(n%3!=0){
    rep(i,n){
      int a;cin>>a;
      if(a){
        cout<<"No"<<endl;
      return 0;}
    }
    cout<<"Yes"<<endl;
  }
  else{
    vi v(3);
    rep(i,n){
      rep(j,3){
        
}
