import math
import sys
N = int(input())
s = input()
sh = []
dot = []
num = 0
for i in s:
    if i == '#':
        num += 1
        sh.append(num)
    else:
        sh.append(num)
num = 0
for i in s:
    if i == '.':
        num += 1
        dot.append(num)
    else :
        dot.append(num)
ans = 1e9
for i in range(N):
    tmp = sh[N-1] - sh[i] + dot[i]
    ans = min(ans, tmp)
print(ans)
