def c_stones(N, S):
    import itertools
    s = [(k, len(list(v))) for k, v in itertools.groupby(S)]
    if s[0][0] == '.':
        del s[0]
    if len(s) > 0 and s[-1][0] == '#':
        del s[-1]
    ans = 0
    for i in range(0, len(s), 2):
        ans += min(s[i][1], s[i + 1][1])
    return ans

N = int(input())
S = input()
print(c_stones(N, S))
