N = int(input())
S = input()
dp = [0 for i in range(N)]
b = 0
w = 0
for i in range(N):
    if S[i] == '.':
        dp[i] = b
    else:
        b += 1

for i in reversed(range(N)):
    if S[i] == '#':
        dp[i] = w
    else:
        w += 1
ans = float('inf')
for i in range(N-1):
    if S[i] == '.' and S[i+1] == '#':
        ans = min(ans,dp[i]+dp[i+1])
if ans == float('inf'):
    print(0)
else:
    print(ans)
