# coding: utf-8

N = int(input())
S = input().strip()

def stone_cnt(idx):
  return S[:idx].count("#") + S[idx:].count(".")

left = 0
right = len(S) - 1

while left <= right:
  mid = (left + right) // 2
  if stone_cnt(left) > stone_cnt(right):
    left = mid + 1
  else:
    right = mid - 1

if S.count("#") == 0 or S.count(".") == 0:
  print(0)
else:
  print(stone_cnt(mid))
