#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve() {
	vector<vector<int> > v;
	for (int i = 0; 8 * i < 1000; i++) {
		vector<int> temp(10, 0);
		int cnt = 3, cur = 8 * i;
		while (cnt)
			temp[cur % 10]++, cur /= 10, cnt--;
		v.push_back(temp);
	}
	string s;
	cin >> s;
	if (s.size() < 3) {
		int cur = stoi(s);
		if (cur < 10) {
			if (cur == 8)
				cout << "Yes";
			else cout << "No";
			return ;
		}
		int first = cur / 10, second = cur % 10;
		if ((first * 10 + second) % 8 == 0 || (second * 10 + first) % 8 == 0) {
			cout << "Yes";
			return ;
		}
		cout << "No";
		return ;
	}
	vector<int> cnt(10, 0);
	for (auto u : s)
		cnt[u - '0']++;
	for (auto u : v) {
		bool ok = 1;
		for (int i = 0; i < 10; i++)
			ok &= (u[i] <= cnt[i]);
		if (ok) {
			cout << "Yes";
			return ;
		}
	}
	cout << "No";

}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t; cin >> t;
	// while (t--)
	solve();

}
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("inline")
// #include<bits/stdc++.h> 
#include<iostream>
#include<string>
using namespace std;

string dfs(int n,string s){
    if(n == 1)return s;
    while(n%3!=1){
        string t;
        for(int i=1;i<n;i++){
            if(s[i]==s[i-1])t+=s[i];
            else {
                int x = 'R'+'W'+'B';
                x -= s[i] + s[i-1];
                t += (char)x;
            }
        }
        swap(t,s);
        n--;
    }
    string t;
    for(int i=0;i<n;i+=3)t+=s[i];
    return dfs((int)t.size(),t);
}
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    cout << dfs(n,s) << endl;
}