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

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

print(ans)
