n=int(input())
s=input()

si=[]
k=[]
count = 0
flag = 0
for i in range(0,n):
    if flag == 0:
        if s[i] == '.':
            count += 1
            if i == n-1:
                si.append(count)
        else:
            si.append(count)
            count = 1
            flag = 1
            if i == n-1:
                k.append(count)
    else:
        if s[i] == '#':
            count += 1
            if i == n-1:
                k.append(count)
        else:
            k.append(count)
            count = 1
            flag = 0
            if i == n-1:
                si.append(count)

if len(si)>0:
    sa=si[0]
else:
    sa=0
if len(k)>0:
    ka=k[-1]
else: ka = 0

smax = sum(si) - sa

kmax = sum(k) - ka

ans = min(smax,kmax)
print(ans)