N = int(input())
S = input()
Bsum = [0] #境界より左にある黒の数
Wsum = [0] #境界より右にある白の数
for i in range(N):
    Bsum = Bsum + [Bsum[-1]+(1 if S[i]=="#" else 0) ]
    Wsum = [Wsum[0]+(1 if S[N-i-1]=="." else 0)] + Wsum
print(min([Bsum[i]+Wsum[i] for i in range(N+1)]))