N = int(input())
S = input()

cnt = 0
S = S[::-1]
if '#' in S:
    idx = S.index('#')
    prev = S[idx]
    for i in S[idx:]:
        if prev == i:
            cnt +=1
        else:
            break

print(cnt)