N = gets.to_i
S = gets.chomp

prev = S[0]
count = 0
strings = []
S.chars.each do |s|
  if prev == s
    count += 1
  else
    strings << [prev, count]
    count = 1
  end
  prev = s
end
strings << [prev, count]

# p strings

ans = 0
prev = strings.first
strings[1..-1].each do |array|
  s = array[0]
  cnt = array[1]
  if s == '.' && prev[0] == '#'
    if prev[1] > cnt
      array[0] = prev[0]
      ans += cnt
    else
      prev[0] = array[0]
      ans += prev[1]
    end
  end
  prev = array
end

p ans
