N = int(input())
s = str(input())
S = list(s[i] for i in range(N))

test = S
countf = 0

if S == list(sorted(S)[::-1]):
    print(0)

else:
    while len(test) != 0:
        a = test.index("#")
        test[a] = "."
        countf += 1
        #print(test)
        del test[0:a+1]
        #print(test)
        if len(test) == 1 or len(test) == 0:
            countf -= 1
            break
        test.reverse()
        b = test.index(".")
        test[b] = "#"
        countf += 1
        #print(test)
        del test[0:b+1]
        #print(test)
        test.reverse()
        if len(test) == 1 or len(test) == 0:
            countf -= 1
            break

    print(countf)
