N = int(input())+1
S = '.' + input()
b,w,flg,ans,w_b = 0,0,0,0,0
for i in range(N):
  if S[-i+1] == '.':
    if flg == 0:
      w += 1
      flg = 1
    elif flg == 1:
      w +=1
    elif flg == 2:
      if b+w_b < w:
        ans += w
        w_b += b+w
      else:
        ans += b
      b,w = 0,1
      flg = 1
  elif flg == 1:
    b+=1
    flg = 2
  elif flg == 2:
    b+=1
print(ans)