n = gets.to_i
s = gets.chomp

cw = 0
cb = 0
a = false
ans = [0, 0]

(n-1).downto(0) do |i|
    if s[i] == "#"
        cb += 1
        a = true
    elsif a
        ans = [ans[0] + cw, ans.min + cb]
        cb = 0
        cw = 1
        a = false
    else
        cw += 1
    end
end

ans = [ans[0] + cw, ans.min + cb] if a

puts ans.min