N = gets.chomp.to_i
S = gets.chomp

w = 0
b = 0
bstart = -1
bend = -1

x = 0
while x < N
  if S[x] == "."
    w += 1
    bend = -1
  else
    if bstart == -1
      bstart = x
    end
    if bend == -1
      bend = x
    end
    b += 1
  end
  x += 1
end

if bend == -1
  bend = N
end

if w == 0 || b == 0
  puts 0
  exit
end

w2 = w - bstart
#b2 = b - (N-bend)
#answer = [w2,b2].min
answer = w2
a = w2

x = bstart
while x < bend
  if S[x] = "#"
    a += 1
  else
    a -= 1
    if a < answer
      answer = a
    end
  end
  x += 1
end

puts answer