N = gets.to_i S = gets.chomp cur_d = -1 (N - 1).downto(0) do |i| next if S[i] == '.' if cur_d == -1 cur_d = N - i else cur_d = [cur_d + 2, N - i].max end end puts cur_d