n = int(input())
s = input()

cnt = 0
tmp_cnt = 0
start_flag = False
count_flag = False
sharp_cnt = 0
for i in range(0, n-1):
  if s[i] == '#' and not start_flag:
    start_flag = True
    sharp_cnt += 1
  elif s[i] == '.' and start_flag:
    tmp_cnt += 1
  elif s[i] == '#' and start_flag:
    sharp_cnt += 1
  if s[i] == '.' and s[i+1] == '#':
    count_flag = True
  if tmp_cnt != 0 and count_flag:
    cnt += min(tmp_cnt, sharp_cnt)
    tmp_cnt = 0
    sharp_cnt = 0
    start_flag = False
    count_flag = False

if s[-1] == '.':
  tmp_cnt += 1
if tmp_cnt != 0:
 cnt += min(tmp_cnt, sharp_cnt)

print(cnt)