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 w+w_b > b:
        ans += b
        w_b += b+w
      else:
        ans = w + w_b
      b,w = 0,1
      flg = 1
  elif flg == 1:
    b+=1
    flg = 2
  elif flg == 2:
    b+=1
print(ans)