from itertools import groupby
import numpy as np
N = int(input())
s = groupby(list(input()))
table = []
for key,group in s:
  cnt = 0
  for id,_ in enumerate(group,1):
    cnt = id
  table.append([key,cnt])
#print(table)
if len(table) == 1:
  print(0)
  exit()
B = [0] * len(table)
W = [0] * len(table)
for i in range(len(table)):
  if table[i][0] == "#":
    B[i] += table[i][1]
  else:
    W[i] += table[i][1]
B = np.cumsum(np.array(B))
W = np.cumsum(np.array(W))
#print(B)
#print(W)
ans = float("inf")
for i in range(len(table)):
  ans = min(ans,B[i] + W[-1] - W[i])
print(ans)