N = int(input())
S = input()
 

if not '#' in S:
  print(0)
elif not '.' in S:
  print(0)
else:
  most_left_black = S.index('#')
  most_right_white = max([i for i, c in enumerate(S) if c == '.' ])

  def white2black(most_left_black):
    subS = S[most_left_black + 1:]
    num_to_replace = subS.count('.')
    return num_to_replace

  def black2white(most_right_white):
    subS = S[:most_right_white]
    num_to_replace = subS.count('#')
    return num_to_replace

  if most_right_white + 1 == most_left_black:
    print(0)
  else:
    print(min(white2black(most_left_black) , black2white(most_right_white)))