N = int(input())
S = input()
SS = list(S)
 
D = 0
 
black = S.split("#")
white = S.split(".")
if len(SS) ==0:
  while SS[0] == ".":
    white.pop(0)
    SS.pop(0)
    if len(SS) ==0:
      break
if len(SS) ==0:    
  while SS[len(SS)-1] == "#":
    black.pop()
    SS.pop()
    if len(SS) ==0:
      break
    
while "" in black:
  black.remove("")
  
while "" in white:
  white.remove("")
  
for b, i in zip(black,white):
  D += min(len(b),len(i))
  
print(D)