N = int(input())
S = input().strip()


cnt = 0
for i in range(N):
    if S[-1 -i] == "#":
        cnt += 1
    else:
        break

for i in range(N):
    if S[i] == ".":
        continue

    print(min(S[i:].count("#") - cnt, S[i:].count(".")))
    exit()

print(0)

