#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long int n;
  cin >> n;
  string v;
  cin >> v;
  unsigned long long int num = 0;
  for (long long int i = 0; i < v.size(); i++)
    if (v[i] == 'B') num = num | (1LL << i);
  cout << num;
  return 0;
}
