import bisect
N = int(input())
S = list(input())
sum = [0]*(N+1)
ans = 100000000000
for i in range(N):
    key = 0
    if S[i]=='#':
        key = 1
    sum[i+1]=sum[i]+key
for i in range(1,len(sum)):
    if sum[i]-sum[i-1] != 0:
        left = sum[i]-0
        right = bisect.bisect_right(sum,sum[i])-1 - i
        tmp = left + right
        ans = min(tmp,ans)

print(ans)
