#include <iostream>
#include <map>
#define int long long
using namespace std;

const int MAXN = 4e5 + 10;
int f[MAXN], g[MAXN];

int C(int n, int k) {
	int sum = f[k] + f[n - k];
	if (f[n] > sum) {
		return 0;
	}
	return g[n] * g[n - k] * g[k] % 3;
}

signed main() {
	g[0] = 1;
	f[1] = 0;
	g[1] = 1;
	for (int i = 2; i < MAXN; ++i) {
		if (i % 3 == 0) {
			int cur = i, cnt = 0;
			while (cur % 3 == 0) {
				cur /= 3;
				cnt++;
			}
			f[i] = f[i - 1] + cnt;
			g[i] = g[i - 1] * cur % 3;
		}
		else {
			g[i] = g[i - 1] * i % 3;
			f[i] = f[i - 1];
		}
	}

	int n;
	cin >> n;
	int ans = 0;
	map<char, int> mp;
	map<int, char> mp_r;
	mp['B'] = 0;
	mp['W'] = 1;
	mp['R'] = 2;
	mp_r[0] = 'B', mp_r[1] = 'W', mp_r[2] = 'R';

	for (int i = 0; i < n; ++i) {
		char c;
		cin >> c;
//		cerr << C(n - 1, i) << endl;
		ans = (ans + C(n - 1, i) * mp[c]) % 3;
	}

	if (n % 2 == 0) {
		cout << mp_r[(3 - ans) % 3] << endl;
	}
	else {
		cout << mp_r[ans] << endl;
	}

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define RREP(i, n) for(int i=(n);i>=0;--i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, b) for(int i=(a);i>=(b);--i)


#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if (i) os << " ";
    os << v[i];
  }
  return os;
}

template <class T>
void debug(const vector<T> &v) {
  cout << "[";
  REP(i, SZ(v)) {
    if(i) cout << ", ";
    cout << v[i];
  }
  cout << "]" << endl;
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  return os << p.first << " " << p.second;
}

template <class T, class U>
void debug(const pair<T, U> &p) {
  cout << "(" << p.first << " " << p.second << ")" << endl;
}

template<class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const ll MOD998 = 998244353;
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;
const int inf = INT_MIN;
const ll linf = LLONG_MIN;
const ld eps = 1e-9;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  vll p = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
  int sz = SZ(p);

  int n; cin >> n;
  vll x(n);
  REP(i, n) cin >> x[i];

  vector<vector<bool>> dp(n+1, vector<bool>(1<<sz, false));
  dp[0][0] = true;

  REP(i, n) {
    REP(j, 1<<sz) {
      if(!dp[i][j]) continue;
      REP(k, sz) {
        if(x[i] % p[k] == 0) {
          if(j>>k&1) {
            dp[i+1][j] = true;
          } else {
            dp[i+1][j|(1<<k)] = true;
          }
        }
      }
    }
  }

  ll ans = LINF;
  REP(i, 1<<sz) {
    if(dp[n][i]) {
      ll val = 1;
      REP(j, sz) {
        if(i>>j&1) {
          val *= p[j];
        }
      }
      chmin(ans, val);
    }
  }
  cout << ans << endl;


  return 0;
}


