n = int(input())
s = list(str(input()))
black = 0
white = 0
count = 0
find = True

for i in reversed(range(0,n)):
    if find == True and s[i] == '#':
        black += 1
    elif s[i] == '.':
        white += 1
        find = True
    if black == white:
        count += white
        white = 0
        black = 0
        find = False
count += black
print(count)