#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
inline long long UB(vector<long long> &v, long long x) {
  return upper_bound(v.begin(), v.end(), x) - v.begin();
}
inline long long LB(vector<long long> &v, long long x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
bool uMin(long long &a, long long b) { return a > b ? (a = b, true) : false; }
bool uMax(long long &a, long long b) { return a < b ? (a = b, true) : false; }
const long long Mod = 1e9 + 6;
inline long long PowMod(long long a, long long b) {
  long long res = 1;
  a %= Mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % Mod;
    a = a * a % Mod;
  }
  return res;
}
const long long MxSize = 200006;
long long n;
string s;
long long nxt[MxSize];
void init() {
  for (long long i = 0; i < (n - 1); ++i) {
    nxt[i] = i + 1;
  }
  nxt[n - 1] = 0;
}
long long findNextDiff(long long start, long long &prev) {
  long long now = nxt[start];
  prev = start;
  if (now == start) return -1;
  while (s[now] == s[start]) {
    if (now == start) return -1;
    prev = now;
    now = nxt[now];
  }
  return now;
}
long long findNextDiff2(long long start, long long &prev) {
  long long now = nxt[prev];
  if (now == start) return -1;
  while (s[now] == s[start]) {
    if (now == start) return -1;
    prev = now;
    now = nxt[now];
  }
  return now;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> n;
  cin >> s;
  init();
  long long head = 0;
  long long targetPrev = 0;
  long long target = findNextDiff(head, targetPrev);
  if (target < 0) {
    cout << (s[head]);
    return 0;
  }
  while (1) {
    nxt[targetPrev] = nxt[target];
    if (head == targetPrev) {
      head = nxt[head];
      target = findNextDiff(head, targetPrev);
      if (target < 0) {
        cout << (s[head]);
        return 0;
      }
    } else {
      head = nxt[head];
      target = findNextDiff2(head, targetPrev);
      if (target < 0) {
        cout << (s[head]);
        return 0;
      }
    }
  }
  return 0;
}
