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