n = gets.to_i
s = gets.chomp
blacks = s.split(".").map { |c| c.size }.reject { |n| n.zero? }
whites = s.split("#").map { |c| c.size }.reject { |n| n.zero? }
min_black_change = blacks.inject(0) { |res, num| res + num }
min_black_change -= blacks[-1] if min_black_change > 0 && s[-1] == "#"
min_white_change = whites.inject(0) { |res, num| res + num }
min_white_change -= whites[0] if min_white_change > 0 && s[0] == "."
puts [min_black_change, min_white_change].min
