s = gets.to_i
n = gets.chomp.split("")
bw = Array.new(2).map{Array.new()}
bw2 = Array.new(4,0)
check = 2
ans = 10**6
inst = 10**6
for i in 1..s
  if check == 0 && n[-i] == "#"
    bw[-1][1] += 1
    bw2[0] += 1
  elsif (check == 0 || check == 2) && n[-i] == "."
    bw.push([1,1])
    check = 1
    bw2[1] += 1
  elsif (check == 1 || check == 2) && n[-i] == "#"
    bw.push([0,1])
    check = 0
    bw2[0] += 1
  else
    bw[-1][1] += 1
    bw2[1] += 1
  end
end
for i in 0..bw.length-1
  if bw[i] = 0
    bw2[0] -= bw[i][0]
    bw2[2] += bw[i][0]
  else
    bw2[1] -= bw[i][1]
    bw2[3] += bw[i][1]
  end
  if ans > [bw2[0],bw2[1]].min + bw2[3]
    ans = [bw2[0],bw2[1]].min + bw2[3]
  end
end
puts ans
