from sys import stdin

def main():
    N = int(input())
    S = input()

    white, black = [], []
    cntw, cntb = 0, 0
    prev = S[0]
    for s in S:
        if prev != s:
            white.append(cntw)
            black.append(cntb)
            cntw, cntb = 0, 0
        if s == '.':
            cntw += 1
        else:
            cntb += 1
        prev = s
    white.append(cntw)
    black.append(cntb)

    if len(white) == 1 and len(black) == 1:
        print(0)
        return
    ans = 0
    for i in range(N-1):
        if black[i] and not black[i+1]:
            ans += min(black[i], white[i+1])
    print(ans)

input = lambda: stdin.readline().rstrip()
main()
