n=int(input())
hoge=input()
flag=hoge[0]
kazu=0
siro=[]
kuro=[]
for i in range(n):
  if(hoge[i]==flag):
    kazu+=1
  else:
    if(flag=="."):
      siro.append(kazu)
      kazu=1
      flag="#"
    else:
      kuro.append(kazu)
      kazu=1
      flag="."
      
if(flag=="."):
  siro.append(kazu)
else:
  kuro.append(kazu)

kuro=kuro[::-1]
ans=[]

ans.append(hoge.count("."))
ans.append(hoge.count("#"))
base=0

if(hoge[0]=="#"):
  base+=kuro[-1]
  kuro=kuro[:len(kuro)-1]
if(hoge[-1]=="."):
  base+=siro[-1]
  siro=siro[:len(siro)-1]

siro=siro[1:]
kuro=kuro[1:]

for i in range(len(siro)+1):
  ans.append(base+sum(siro[:i])+sum(kuro[i:]))
  
print(min(ans))