#include <bits/stdc++.h>
using namespace std;
int n;
string S;
int main() {
  cin >> n >> S;
  long long mask = 0;
  for (int i = (n - 1); (i) >= (0); i--) {
    mask <<= 1;
    if (S[i] == 'R') mask |= 1LL;
  }
  cout << ((1LL << n) - 1 - mask) << endl;
  return 0;
}
