N = int(input())
S = input()
i = 0
for i in range(N):
    i += 1
    if S[i - 1] == '#':
        break

T = S[i - 1:]
W = T.count('.')

cnt = 0
x = 0
for j in range(N - i - 1):
    if T[j] == '#':
        cnt += 1
    else:
        x = cnt

print(min(x, W))