import numpy as np

dic={'.':0,'#':1}
N=int(input())
S=np.array([dic[i] for i in input()])
arr=np.flip(np.triu(np.ones((N,N))),axis=1)==0

if S.sum()==0:
    print(0)
elif S.sum()==N:
    print(0)    
else:
    print(min((arr!=S).sum(axis=1)))