
n = input()
s = input()
s_list = list(s)
dot_cnt =0
sharp_cnt = 0
include = 1
for i in range(0, len(s_list)-1):
    print("i", i)
    if (s_list[i] == "#") and (s_list[i+1] == "."):
        if (i+1) == (len(s_list)-1):
            dot_cnt += 1
        else:
            for h in range(1,(len(s_list)-1)-(i+1) + include):
                print("h", h)
                # if (i+1)+h == len(s_list):
                #     dot_cnt += h-1
                #     # print("dot_cnt_over", dot_cnt)
                #     break
                if s_list[i+1+h] == "#":
                    dot_cnt += h
                    print("dot_cnt", dot_cnt)
                    break
                if h == ((len(s_list)-1)-(i+1)) :
                    dot_cnt += (len(s_list)-1) - i
                    print("dot_cnt_over", dot_cnt)
                # 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] == "#"):
        if (i-1) == 0:
            sharp_cnt += 1
        else:
            for j in reversed(range(0,i-1)):
                if s_list[j] == ".":
                    sharp_cnt += (i-1)-j
                    break
                if j == 0:
                    sharp_cnt += i
                    break

print(min(dot_cnt, sharp_cnt))