n = int(input())
S = input()
cwr = -1
cbren = 0
cb = 0
for s in S:
    if cwr == -1 and s == '#':
        cwr = 0
        cbren += 1
    elif cwr >= 0 and s == '.':
        cwr += 1
        cb += cbren
        cbren = 0
    elif cwr >= 0 and s == '#':
        cbren += 1

print(min(cb, max(0, cwr)))
