N = int(input())
S = list(input())
fb = -1
for i in range(N):
    if S[i] == '#':
        fb = i
        break

cnt = 0
S = S if fb == -1 else S[fb:]
for s in S:
    if s == '#':
        cnt += 1

if cnt:
    print(min(len(S) - cnt, cnt))
else:
    print(0)
