#import numpy as np
N = int(input())
S = input()

penals1 = []
tmp1 = 0
for s in S:
    if s == "#":
        tmp1 += 1
    penals1.append(tmp1)


penals2 = []
tmp2 = 0
for s in reversed(S):
    if s == ".":
        tmp2 += 1
    penals2.insert(0, tmp2)

penals = [penals2[0]] + [penals1[i] + penals2[i+1] for i in range(1, N-1)] + [penals1[N-1]]
out = min(penals)
print(out)