N = int(input()) 
S = input() 

#.......######
# a[n] = n個目より左にある#の数
# b[n] = n個目より右にある.の数

a = [0] * (N+2)
b = [0] * (N+2)

cnt = 2
for x in S:
    if x == "#":
        a[cnt] = a[cnt-1] + 1
    else:
        a[cnt] = a[cnt-1] 
    cnt += 1

cnt =N
Sinv = S[::-1]
for x in S:
    if x == ".":
        b[cnt] = b[cnt+1] + 1
    else:
        b[cnt] = b[cnt+1] 
    cnt -= 1



c = []

for index in range(N+2):
    c.append(a[index] + b[index])
c[0] = 999999

print(min(c))
