N = int(input())
S = input()
blacknum = []
whitenum = []
cnt = 0
now = 0
blackcnt = 0
whitecnt = 0

for i in range(N):
    if now == 0 and S[i] == '#':
        whitenum.append(whitecnt)
        blackcnt += 1
        now = 1
    elif now == 1 and S[i] == '.':
        blacknum.append(blackcnt)
        whitecnt += 1
        now = 0
    elif now == 0 and S[i] == '.':
        whitecnt += 1
    else:
        blackcnt += 1

if now == 0:
    whitenum.append(whitecnt)
else:
    blacknum.append(blackcnt)
if len(whitenum) == len(blacknum):
    whitenum.append(whitecnt)

ans = whitecnt
for i in range(len(blacknum)):
    tmp = blacknum[i] + (whitenum[-1] - whitenum[i+1])
    if tmp < ans:
        ans = tmp

print(ans)