L = int(input())
S = input()

# . : white
# # : black

# no '#.' sequence
# All '......'  Start of black is (length + 1)
# All '######'  Start of black is (0)
# ONLY '...###' Start of black is (?)

# a list of tuples of (start,end) for each color
white, black = [], []
nwhite, nblack = 0, 0

i, end = 0, 0
while(i<L):
    while(end<L):
        if S[i] == S[end]:
            end += 1
        else:
            break

    if S[i] == '.':
        white.append((i,end))
        nwhite += end-i
    else:
        black.append((i,end))
        nblack += end-i

    i = end

if nwhite == 0 or nblack == 0:
    print(0)

else:
    ans = 2 * (10 ** 5) + 1
    # set a index that starts sequence of black(#)
    for i, (candidate, curend) in enumerate(black):

        curans = 0

        # then turn over all black(#) left to it
        for (s,e) in black[:i]:
            curans = curans + e -s

        # then turn over all white(.) right to it    
        for (s,e) in white:
            if s > candidate:
                curans = curans + e -s 

        ans = min(ans, curans)

    print(ans)