def main():
    N = int(input())
    S = input()
    # ans_w, ans_b = 0, 0

    # started = False
    # for s in S:
    #     if s == '#':
    #         started = True
    #     if started and s == '.':
    #         ans_w += 1
    # started = False
    # for i in range(N):
    #     s = S[N - 1 - i]
    #     if s == '.':
    #         started = True
    #     if started and s == '#':
    #         ans_b += 1
    # print(min(ans_w, ans_b))
    Ws, Bs = [], []
    c = S[0]
    l = 1
    for i in range(1, N):
        s = S[i]
        if c == s:
            l += 1
        else:
            if c == '.':
                Ws.append(l)
            else:
                Bs.append(l)
            l = 1
            c = s
    if c == '.':
        Ws.append(l)
    else:
        Bs.append(l)
    # print(Ws, Bs)
    len_ws = len(Ws)
    len_bs = len(Bs)
    if len_ws == 0 or len_bs == 0:
        print(0)
        return
    if len_ws == 1:
        if len_bs == 1:
            if S[0] == '.':
                print(0)
            else:
                print(min(Bs[0], Ws[0]))
        else:
            # len_bs == 2
            print(min(Ws[0], Bs[0]))
        return
    if len_bs == 1:
        # len_ws == 2
        print(min(Ws[1], Bs[1]))
        return

    # len_ws >= 2 and len_bs >= 2
    sum_w_s, sum_w_r, sum_b_s, sum_b_r = [0]*len_ws, [0]*len_ws,  [0]*len_bs, [0]*len_bs
    sum_w_s[0] = Ws[0]
    sum_w_r[0] = Ws[-1]
    sum_b_s[0] = Bs[0]
    sum_b_r[0] = Bs[-1]
    for i in range(1, len_ws):
        sum_w_s[i] = sum_w_s[i - 1] + Ws[i]
        sum_w_r[i] = sum_w_r[i - 1] + Ws[len_ws - 1 - i]
    for i in range(1, len_bs):
        sum_b_s[i] = sum_b_s[i - 1] + Bs[i]
        sum_b_r[i] = sum_b_r[i - 1] + Bs[len_bs - 1 - i]
    # print(sum_w_s, sum_w_r, sum_b_s, sum_b_r)
    ans = min(sum_w_s[-1], sum_b_s[-1])
    if S[0] == '#':
        for i in range(len_ws - 1):
            a = sum_b_s[i] + sum_w_r[len_ws - 2 - i]
            ans = min(a, ans)
    else:
        for i in range(len_ws - 1):
            a = sum_w_r[i] + sum_b_s[len_bs - 2 - i]
            ans = min(a, ans)
    print(ans)

if __name__ == '__main__':
    main()
