
n = input()
s = input()
s_list = list(s)
dot_cnt =0
sharp_cnt = 0
for i in range(0, len(s_list)-1):
    # print("i", i)
    if s_list[i] == "#" and (s_list[i+1] == "."):
        for h in range(1,len(s_list)):
            if i+h == len(s_list):
                dot_cnt += h-1
                # print("dot_cnt_over", dot_cnt)
                break
            if s_list[i+h] == "#":
                dot_cnt += h-1
                # print("dot_cnt", dot_cnt)
                break
            # if i+h == len(s_list)-1:
            #     dot_cnt += h+1
            #     break
for i in range(1, len(s_list)):
    if s_list[i] == "." and (s_list[i-1] == "#"):
        for j in reversed(range(0,i)):
            if s_list[j] == ".":
                sharp_cnt += i-j-1
                break
            if j == 0:
                sharp_cnt += i
                break

print(min(dot_cnt, sharp_cnt))