N = int(input())
S = input()
S = S[::-1]
S += 'X'
tmps = 0; tmpd = 0
sharp = []; dot = []
if '#' not in list(S) or '.' not in list(S):
    print(0)
else:
    for i in range(N):
        if S[i] == '#':
            tmps += 1
            if S[i+1] != '#':
                sharp.append(tmps)
                tmps = 0
        if S[i] == '.':
            tmpd += 1
            if S[i+1] != '.':
                dot.append(tmpd)
                tmpd = 0
    if S[0] == '#':
        del sharp[0]
        ans = sum(sharp)
    else:
        del sharp[0]
        ans = sum(sharp) + dot[0]
    print(ans)