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

white_count = 0
safe_black_count = 0
safe_white_count = 0

for i in range(N-1,-1,-1):
  if S[i] == "#":
    safe_black_count += 1
  else:
    break
    
for i in range(N):
  if S[i] == ".":
    safe_white_count += 1
  else:
    break
    
for i in range(N):
  if S[i] == ".":
    white_count += 1

error_black_count = N-white_count-safe_black_count
error_white_count = white_count-safe_white_count

print(min(error_white_count,error_black_count))
  
  


  