N = int(input())
S = input()
SS = list(S)
 
D = 0
 
black = S.split("#")
white = S.split(".")

if S[0] == ".":
  black.pop(0)
 
if S[-1] == "#":
  white.pop()
    
black = [bb for bb in black if bb != ""]
white = [ww for ww in white if ww != ""]
  
for b, i in zip(black,white):
  D += min(len(b),len(i))
  
print(D)