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

#define REP(i,a,b) for(int i=a;i<=b;i++)
using LL = long long;

const int Nmax=2e5+9;
int N,A[39],S,ans=INT_MAX,tmp1,tmp2;

int main() {
    ios_base::sync_with_stdio(0);    cin.tie(0);
    cin>>N;
    REP(i,1,N) cin>>A[i];
    S=(1<<(N-1))-1;
    REP(k,0,S) {
        tmp1=tmp2=0;
        REP(i,1,N) {
            if (i>=2 && ((k>>(i-2))&1)) {
                tmp2^=tmp1;     tmp1=0;
            }
            tmp1|=A[i];
        }
        tmp2^=tmp1;
        ans=min(ans,tmp2);
        // cout<<k<<" "<<tmp2<<" "<<ans<<endl;
    }
    cout<<ans;
    return 0;
}

//#pragma GCC optimize ("O3", "unroll-loops")
//#pragma GCC target ("avx2")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define all_of(v) (v).begin(), (v).end()
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define fi first
#define se second
//const int MAXN = 300005;
//const LL INF = (LL) 1e9 + 8763;
//const LL MOD = (LL) 998244353;
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int P = 3;
int fact[10];
int inv(int x) {
	return x;
}
int mod_fact(int n,int &e){
	e=0;
	if(n==0)return 1;
	int res=mod_fact(n/P,e);
	e += n/P; 
	if((n/P)%2==0)return res*fact[n%P]%P;
	return res*(P-fact[n%P])%P;
}
int Cmod(int n,int m){
	int a1,a2,a3,e1,e2,e3;
	a1=mod_fact(n,e1);
	a2=mod_fact(m,e2);
	a3=mod_fact(n-m,e3);
	if(e1>e2+e3)return 0;
	return a1*inv(a2*a3%P)%P;
}

int n;
string s;
int c2i[256];
char i2c[3] = {'B', 'W', 'R'};

void solve() {
	fact[0] = 1;
	for (int i = 1; i < 10; i++) {
		fact[i] = fact[i - 1] * i % P;
	}
//	for (int i = 0; i < 10; i ++) {
//		for (int j = 0; j <= i; j++) {
//			cout << Cmod(i, j) << ' ';
//		}
//		cout << '\n';
//	}
	
	cin >> n;
	c2i['B'] = 0;
	c2i['W'] = 1;
	c2i['R'] = 2;
	
	int lay = n, ans = 0, sign = (lay % 2 ? 1 : -1);
	for (int i = 0; i < n; i++) {
		char ch;
		cin >> ch;
		int x = c2i[ch];
		ans = (ans + x * Cmod(n - 1, i) * sign) % 3;
	}
	ans = (ans % 3 + 3) % 3;
	cout << i2c[ans] << '\n';
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

	int tc = 1;
//	cin >> tc;
	for (int i = 1; i <= tc; i++) {
		solve();
	}
 
	return 0;
}