import sys

sys.setrecursionlimit(10000000)


def check_and_back_or_go_to(li, ind, N, counter, white_charge):
    back = True
    # print('see {} {} and {} counter{}'.format(ind, li[ind - 1], li[ind], counter))
    if ind == 0:
        return counter

    # access
    if li[ind - 1] == '#' and li[ind] == '.':
        c = check_and_back_or_go_to(li, ind - 1, N, counter + 1 + white_charge, 0)
        return c
    elif li[ind - 1] == '.' and li[ind] == '.':
        return check_and_back_or_go_to(li, ind - 1, N, counter, white_charge + 1)
    else:
        c = check_and_back_or_go_to(li, ind - 1, N, counter, white_charge)
        return c


N = int(input())
S = list(input())
r = range(N)
if N == 1:
    print(0)
    exit(0)
bsk = False
key = -1
for i in range(len(S)):
    if not bsk:
        if S[i] == '#':
            bsk = True
            key = i
    else:
        if S[i] != '#':
            bsk = False

if bsk:
    # print('bsk occured')
    # print([S[i] for i in range(key)])
    count = check_and_back_or_go_to([S[i] for i in range(key)], key  - 1, N, 0, 0)
    print(min([count, key - count]))
else:
    count = check_and_back_or_go_to(S, len(S) - 1, N, 0, 0)
    print(min([count, N - count]))
