n=int(input())
s_o=input()
s_dot=[len(x) for x in s_o.replace("#"," ").split()]
s_sharp=[len(x) for x in s_o.replace("."," ").split()]
if s_o[0]==".":
  s_dot=s_dot[1:]
if s_o[-1]=="#":
  s_sharp=s_sharp[:-1]
if len(s_dot)==0 or len(s_sharp)==0:
  print(0)
  exit()
sum_sharp=[0]*len(s_sharp)
sum_dot=[0]*len(s_dot)
for i in range(len(sum_sharp)):
  if i==0:
    sum_sharp[i]=s_sharp[i]
  else:
    sum_sharp[i]=sum_sharp[i-1]+s_sharp[i]

for i in reversed(range(len(sum_dot))):
  if i==len(sum_dot)-1:
    sum_dot[i]=s_dot[i]
  else:
    sum_dot[i]=sum_dot[i+1]+s_dot[i]
ans=[1000000]*len(sum_sharp)
for i in range(len(sum_sharp)):
  ans[i]=sum_sharp[i]+sum_dot[-i-1]-max(sum_sharp[i],sum_dot[-i-1])
print(min(ans))