N = gets.to_i
S = gets.to_s
black = []
white = []
if S[0] == '.'
  black << 0
  white << 1
else
  black << 1
  white << 0
end
(1..N).each do |i|
  if S[i] == '#'
    black << black[i-1] + 1
    white << white[i-1]
  else
    black << black[i-1]
    white << white[i-1] + 1
  end
end
mem1 = [black[N-1], white[N-1]].min
(0..N).each do |i|
  mem2 = black[i] + white [N-1] - white [i]
  mem1 = [mem1, mem2].min
end
p mem1