# coding: utf-8

N = gets.to_i
S = gets.chomp

a = S.split(/(?<=\.)(?=\#)|(?<=\#)(?=\.)/).map(&:size)

if S[0] == '.'
  a.unshift(0)
end
if S[-1] == '#'
  a.push(0)
end

→ = a.select.each_with_index {|_, i| i.even? }.inject([0]) do |memo, item|
  memo << memo.last + item
end
← = a.reverse.select.each_with_index {|_, i| i.even? }.inject([0]) do |memo, item|
  memo << memo.last + item
end
ans = →.zip(←.reverse).map do |ltr, rtl|
  ltr + rtl
end.min

puts ans
