def main():
  N = int(input())
  S = input()
  black = S.count('#')
  white = S.count('.')

  if black == 0 or white == 0:
    print(0)
    return 
 	
  B = [0]*(N+1)
  W = [0]*(N+1)
  for i in range(N):
    if S[i] == '#':
      B[i+1] = 1
    elif S[i] == '.':
      W[i+1] = 1
  
  for i in range(1,N+1):
    B[i]+=B[i-1]
    W[i]+=W[i-1]
  ans = float('inf')
  for i in range(1,N+1):
    ans = min(ans, B[i]+white-W[i])
  
  print(ans)
  return
main()