#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned n;
  string seq;
  cin >> n >> seq;
  size_t skip = 0;
  char prev = seq.front();
  for (size_t cur = 0; cur < seq.size(); ++cur) {
    if (prev == seq[cur] || skip == 0) {
      prev = seq[cur];
      skip++;
    } else {
      seq.push_back(prev);
      skip--;
    }
  }
  cout << seq.back() << endl;
  return 0;
}
