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 test != list(sorted(test)[::-1]):
        test[test.index("#")] = "."
        countf += 1
        if test == list(sorted(test)[::-1]):
            break
        test[s.rfind(".")] = "#"
        countf += 1

    print(countf)
