n = int(input())
s = list(input())
arr = []
ans = 0
for i, word in enumerate(s):
    if word == '#':
        arr.append(i)

for i in range(len(arr) - 1):
    ans += arr[i+1] - arr[i]

if arr[-1] != n-1:
    ans += n - arr[-1] - 1

ans -= len(arr) - 1
print(ans)