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

test = S
#testb = S

countf = 0
countb = 0
#print(test)
#print(s)

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

else:
    while test != list(sorted(test)[::-1]):
        del test[test.index("#")]
        test.insert(0, ".")
        countf += 1
        #print(test)
        if test == list(sorted(test)[::-1]):
            break
        del test[s.rfind(".")]
        test.append("#")
        countf += 1
        #print(test)


#    while testb != list(sorted(testb)[::-1]):
#        del testb[testb.rindex(".")]
#        testb.append("#")
#        countb += 1
#        print(testb)
#        if testb == list(sorted(testb)[::-1]):
#            break
#        del testb[testb.index("#")]
#        testb.insert(0, ".")
#        countb += 1
#        print(testb)

#if countf<countb:
    print(countf)
#else:
#    print(countb)
