n=int(input())
s=input()
"""
x=n
flag1=False
flag2=False
for i in range(n):
    if s[i]=="#" and flag1==False:
        x=i
        flag1=True
    if s[n-1-i]!="#" and flag2==False:
        y=n-i
        flag2=True
    if flag1==True and flag2==True:
        break

S=s[x:y]

b=S.count("#") 
w=len(S)-b
cb=0
cw=0
for i in range(len(0,S-1))[::-1]:

    if S[i]==".":
        cw=cw+1
    if S[i]=="#":
        cb==cw+1
    if S[i]!=S[i-1]:
        cb>cw
"""
b=0
w=s.count(".")
ans = n
for i in range(n):
    if s[i]!=s[i-1] and i>0:
        ans=min(ans,b+w)
    if s[i]=="#":
        b=b+1
    if s[i]==".":
        w=w-1
    
print(min(ans,b+w))