n = int(input())
s = input()

bcnt = []
wcnt = []

if s[0]=="#":
    bcnt += [1]
    wcnt += [0]
else:
    bcnt += [0]
    wcnt += [1]

for i in range(1,n):
    if s[i]=="#":
        bcnt += [bcnt[i-1]+1]
        wcnt += [wcnt[i-1]]
    else:
        bcnt += [bcnt[i-1]]
        wcnt += [wcnt[i-1]+1]

# print(bcnt)


wcnt.reverse()

# print(wcnt)

nuru = [-1]*(n+1)
nuru[0] = wcnt[0]

for i in range(1,n):
    nuru[i] = wcnt[i]+bcnt[i-1]
    
nuru[n] = bcnt[n-1]

# print(nuru)

print(min(nuru))