#include <bits/stdc++.h>
using namespace std;
int n,b[1001];
int main()
{
    cin >> n;
    for (int i = 2; i <= n; i++)
    {
        cin>>b[i];
    }
    if(n%3==0)
    {
    	cout<<"Yes";
    }
    else
    cout <<"No";
}