N = int(input())
S = input()
dp = [0 for i in range(N)]
b = 0
w = 0
flag1 = True
flag2 = True
for i in range(N):
    if flag1 and S[i] == '.':
        pass
    elif flag1:
        flag1 = False
        b += 1
    elif S[i] == '.':
        dp[i] = b
    else:
        b += 1

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

if ans == float('inf'):
    print(0)
else:
    print(ans)
