N=int(input())
S=str(input())
v=[0]*(2*(10**5)+15)
c=0
if S[0]=="#":
    v[0]+=1
    for i in range(N-1):
        if S[i]==S[i+1]:
            v[c]+=1
        else:
            c+=1
            v[c]+=1

    print(v)

else:
    c=1
    for i in range(N-1):
        if S[i]==S[i+1]:
            v[c]+=1
        else:
            c+=1
            v[c]+=1

    print(v)

pp = [0]*((2*(10**5)+5))
pp[0]= v[0]+v[(2*(10**5)+3)]

for i in range((2*(10**5)+6)/2):
    v[i+2]=v[i]+v[i+2]

for i in range((2*(10**5)+4)/2):
    pp[i+1] = v[2*(i+1)]+v[(2*(10**5)+3)]-v[2*i+1]



if max(pp)==0:
    print(max(pp))
else:
    pp.pop(0)
    print(min(pp))