User ainta has a stack of n red and blue balls. He can apply a certain operation which changes the colors of the balls inside the stack.

  While the top ball inside the stack is red, pop the ball from the top of the stack.  Then replace the blue ball on the top with a red ball.  And finally push some blue balls to the stack until the stack has total of n balls inside.   

If there are no blue balls inside the stack, ainta can't apply this operation. Given the initial state of the stack, ainta wants to know the maximum number of operations he can repeatedly apply.


-----Input-----

The first line contains an integer n (1 ≤ n ≤ 50) — the number of balls inside the stack.

The second line contains a string s (|s| = n) describing the initial state of the stack. The i-th character of the string s denotes the color of the i-th ball (we'll number the balls from top to bottom of the stack). If the character is "R", the color is red. If the character is "B", the color is blue.


-----Output-----

Print the maximum number of operations ainta can repeatedly apply.

Please, do not write the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.


-----Examples-----
Input
3
RBR

Output
2

Input
4
RBBR

Output
6

Input
5
RBBRR

Output
6



-----Note-----

The first example is depicted below.

The explanation how user ainta applies the first operation. He pops out one red ball, changes the color of the ball in the middle from blue to red, and pushes one blue ball.

 [Image] 

The explanation how user ainta applies the second operation. He will not pop out red balls, he simply changes the color of the ball on the top from blue to red.

 [Image] 

From now on, ainta can't apply any operation because there are no blue balls inside the stack. ainta applied two operations, so the answer is 2.

The second example is depicted below. The blue arrow denotes a single operation.

 [Image]

Difficulty: interview

Starter code:

Solutions:
n, b = input(), input().replace('R', '0').replace('B', '1')
print(int(b[:: -1], 2))

import re

n = int(input())
s = [1 if x == "B" else 0 for x in list(input())]
print(sum([el * 2 ** i for i, el in enumerate(s)]))


n = int(input())
s = [1 if x == "B" else 0 for x in list(input())]
print(sum([el * 2 ** i for i, el in enumerate(s)]))


n=int(input())
B=input()
ans=0
for i in range(n-1,-1,-1):
    ans=ans*2+int(B[i]=='B')
print(ans)


n, s = int(input()), input()
print(sum(2 ** i for i in range(n) if s[i] == 'B'))


n = int(input())
s = input().strip()
ans  = 0
for i in range(len(s)):
    if s[i] == "B":
        ans += 2 ** i
print(ans)

n = int(input())
s = ''.join("1" if c == "R" else "0" for c in input()[::-1])
d = int(s, 2)
print((1 << n) - 1 - d)

input()
print(int(''.join("0" if c == "R" else "1" for c in input()[::-1]), 2))

import math,string,itertools,fractions,heapq,collections,re,array,bisect
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict


def main(n,s):
    if 'B' not in s:
        print(0)
        return
    b = s.count("B")
    r = s.count("R")
    op = {}
    op[0] = 1
    op[1] = 2
    op[2] = 4
    op[3] = 1 + op[2] + op[1] + op[0]
    op[3] = 8
    op[4] = 1 + op[3] + op[2] + op[1] + op[0]
    op[4] = 16
    ans = 0
    for i,x in enumerate(s):
        if x=="B":
            ans += 2**i
    print(ans)


def main_input(info=0):
    #n,p,k = map(int,input().split())
    #t = [(int(x)-1,i+1) for i,x in enumerate(input().split())]
    #l,r = list(range(n)), list(range(n))
    #for i in range(n):
    #    l[i],r[i] = map(int,input().split())
#    t = [map(int,input().split()) for x in range(n)]
    n = int(input())
    s = input()
    main(n,s)

def __starting_point():
    main_input()

__starting_point()

s = input()
#s = "5"
n = int(s)

s = input()
#s = "RBBRR"
x = s

ans = 0
for i in range(0, n):
    if x[i] == 'B':
        ans += 1 << i
        
print(ans)

n = int(input())
s = input().split()[0]
res = 0
for i in range(len(s)):
    if s[i] == 'B':
        res += 2**i
print(res)


n = input()
s = input()
answ = 0
k = 0
for i in range(len(s)):
    if s[i] == "B":
        answ+=2**i
print(answ)

n = int(input())
s = input()
ans = 0
b = [0] * 50
b[0] = 1
for i in range(50):
    b[i] = 2 * b[i - 1] + 1
#print(b)
for i in range(n):
    if (s[i] == 'B'):
        ans += 1
        if (i > 0):
            ans += b[i - 1]
print(ans)

input()
print(int(''.join("0" if c == "R" else "1" for c in input()[::-1]), 2))

n = int(input())
s = list(input())
o = 0
#s.reverse()

# while s.count("B") > 0:
#   while s[-1] == "R":
#     s.pop()
#   s[-1] = "R"
#   while len(s) < n:
#     s.append("B")
#   o += 1
#   print(s)

try:
  index = s.index("B")
  o += pow(2, index)
  while True:
    index = s.index("B", index + 1)
    o += pow(2, index)
except:
  print(o)


n = int(input())
s = input()
count = 0

for i in range(n):
    if s[i] == 'B':
        count += 2 ** i
print(count)

n = int(input())
s = input()
ans = 0
for i in range(len(s)):
    ch = s[i]
    if ch == 'B':
        ans |= 1 << i
print(ans)

input()
print(int(''.join("0" if c == "R" else "1" for c in input()[::-1]), 2))

input()
print(int(''.join("0" if c == "R" else "1" for c in input()[::-1]), 2))


input()
print(int(''.join("0" if c == "R" else "1" for c in input()[::-1]), 2))


input()
print(int(''.join("0" if c == "R" else "1" for c in input()[::-1]), 2))


input()
print(int(''.join("0" if c == "R" else "1" for c in input()[::-1]), 2))


input()
print(int(''.join("0" if c == "R" else "1" for c in input()[::-1]), 2))


input()
print(int(''.join("0" if c == "R" else "1" for c in input()[::-1]), 2))


input()
print(int(''.join("0" if c == "R" else "1" for c in input()[::-1]), 2))