N = int(input())
S = input()
SS = list(S)
 
D = 0
 
black = S.split("#")
white = S.split(".")
while SS[0] == ".":
  white.pop(0)
  SS.pop(0)
  
while SS[-1] == "#":
  black.pop()
  SS.pop()
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)