"""
python3 a.py < input.txt
"""
import math
import itertools as it
import heapq

N=int(input())
S=input()

T=[S[0]]
U=[1]
for si in S[1:]:
    if T[-1] == si:
        U[-1] = U[-1]+1
    else:
        T.append(si)
        U.append(1)
M=len(T)
B=[U[i] if T[i] == "#" else 0 for i in range(M)]
W=[U[i] if T[i] == "." else 0 for i in range(M)]
l=[sum(B), sum(W)]
for i in range(M):
    if T[i] == "#":
        l.append(sum(B[:i]) + sum(W[min(i+1, M-1):]))

#print(S)
#print(T)
#print(U)
#print(B)
#print(W)
#print(l)
print(min(l))