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

last = N - 1
while (last >= 0 and S[last] == '#'):
  last -= 1

answer = 0
if (last > 0):
  black = 0
  white = 0
  count_white = False
  for i in range(last + 1):
    if (S[i] == '#'):
      count_white = True
      black += 1
    else:
      if (count_white):
        white += 1
  answer = min(black, white)

print(answer)
