from itertools import groupby
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()
table = table[::-1]
B = 0
W = 0
for t in table:
  if t[0] == ".":
    W += t[1]
  else:
    B += t[1]
if table[-1][0] == ".":
  W -= table[-1][1]
print(min(B,W))