length = gets.to_i
str = gets.strip.to_s
reverse = str.reverse

ex_ch = nil
count = 0

w_count = 0
b_count = 0

str.each_char do |ch|
  if ch == '.'
    w_count += 1
  else
    b_count += 1
  end
end

if b_count > w_count
  str.each_char do |ch|
    if ch == '.' && ex_ch =='#'
      count += 1
      ex_ch = '#'
    else
      ex_ch = ch
    end
  end
else
  reverse.each_char do |ch|
    if ch == '#' && ex_ch =='.'
      count += 1
      ex_ch = '.'
    else
      ex_ch = ch
    end
  end
end

puts count