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

white = 0
black = 0
for c in S:
  if (c == '#'):
    black += 1
  else:
    white += 1

answer = 0
if (white > 0 and black > 0):
  black_left = 0
  white_left = 0
  answer = N
  for i in range(N):
    if (S[i] == '#'):
      black_left += 1
    else:
      white_left += 1
    black_right = black - black_left
    white_right = white - white_left
    answer = min(answer, black_left + white_right)

print(answer)
