n = int(input())
s = input()
a = 0
cnt1 = 0
cnt2 = 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] == '#':
        cnt1 += 1
    else:
        cnt2 += 1
        
print(min(cnt1,cnt2))