from collections import deque
N = int(input())
S = input()

dq = deque()
for s in S:
    if not dq:
        dq.append(s)
    elif dq[-1] == "#" and s == ".":
        dq.pop()
        dq.append(s)
    else:
        dq.append(s)

ans = N - len(dq)
print(ans)