n = int(input())
s = input()
a = 0;b = 0
flag = 0
cnt1 = 0;cnt2 = 0;cnt3 = 0

for i in range(n):
    if s[n-i-1] == "#":a += 1
    else:break
s = s[0:n-a]

for i in range(n-a):
    if s[i] == ".":
        b += 1
    else:break
s = s[b:]

while flag == 0:
    n = len(s);a = 0;c = 0
    if n == 0:
        break
    for i in range(n):
        if s[n-i-1] == ".":a += 1
        else:break
           
    while (s[n-a-c-1] == "#"):
        c += 1
        continue
        
        if c >= a:
            s = s[0:n-c-a]
            cnt3 += a
            flag = 0
        else:
            flag = 1

for i in range(n):
    if s[i] == "#":
        cnt1 += 1
    else:
        cnt2 += 1

cnt3 += min(cnt1,cnt2)
print(cnt3)
