import strutils,future,sequtils
let
  n=stdin.readline.parseInt
  s=stdin.readline
var
  white=s.filterit(it=='.').len#s全体のwhite,blackの数
  black=s.filterit(it=='#').len
  (white1,black1)=(0,0)
  rec:seq[int]= @[]
var mn=white
for i in s:
  if i=='.':
    white1.inc
  else:
    black1.inc
  rec.add(white-white1+black1)
echo rec.min