N = gets.to_i
S = gets.chomp

black_count = 0
white_count = 0
ans = 0
S.each_char do |c|
  if black_count <= 0
    if c == '#'
      black_count = 1
      white_count = 0
    end
  else
    if c == '#'
      if white_count <= 0
        black_count += 1
      else
        ans += [black_count, white_count].min
        black_count = 1
        white_count = 0
      end
    else
      white_count += 1
    end
  end
end

if white_count > 0
  ans += [black_count, white_count].min
end

puts ans
