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

    cnts = 0; cntd = 0; ans = 0
    S.append('#')
    for i in range(N+1):
        if cnts == 0 and S[i] == '.':
            continue
        if S[i] == '#' and cntd == 0:
            cnts += 1
        elif S[i] == '.':
            cntd += 1
        else:
            ans += min(cnts, cntd)
            cnts = 1
            cntd = 0
    
    print(ans)

if __name__ == "__main__":
    main()
