n = int(input())
S = input()
w,b = 0,0
c = S[::-1]

for d in range(len(c)):
    if c[d] != '#':
        break

for s in S:
    if s == '.':
        w += 1
    else:
        b += 1

if d > 0:
    b-= d
if b > w:
    print(w)
else:
    print(b)
