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

ans_ = 0
ans = 0
first = 0
for i, s in enumerate(S):
    check = -1
    if i == N-1:
        break
    if s is '#':
        ans_ += 1
        ans__ = 0
        for s_ in S[i+1:]:
            if s_ is '#':
                break
            if s_ is '.' :
                ans__ += 1
                check = 1
        if check == 1:
            if first == 0:
                ans += min(ans_, ans__)
                first = 1
            else:
                ans += max(ans_, ans__)
            ans_ = 0

print(ans)