from collections import deque

N = int(input())
S = input()

que = deque([])

flag = False # White
tmp = 0

for s in S:
    if flag:
        if s == "#":
            tmp += 1
        else:
            que.append(tmp)
            tmp = 1
            flag = not flag
    else:
        if s == ".":
            tmp += 1
        else:
            que.append(tmp)
            tmp = 1
            flag = not flag

que.append(tmp)

if not flag:
    que.append(0)


# dont care
que.popleft()
que.pop()

if len(que) == 0:
    print(0)
    exit()

fe = que.popleft()
be = que.pop()
result = 0

while 1:
    if fe > be:
        result += be
        if len(que) == 0:
            break
        else:
            que.pop()
            be = que.pop()
    else:
        result += fe
        if len(que) == 0:
            break
        else:
            que.popleft()
            fe = que.popleft()


print(result)
