from sys import stdin
# import math
import numpy as np
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = stdin.readline().rstrip().split()[0]

N = int(stdin.readline().rstrip().split()[0])
S = stdin.readline().rstrip().split()[0]

white = S.count(".")
ans1=0
if white == N:
  ans1=0
else:
  first_black = S.index("#")
  ans1 = white - first_black
  
ans2=0
black = N-white
last_white = S[::-1].index(".")
ans2=black-last_white

if ans1>ans2:
  print(ans2)
else:
  print(ans1)
