N = int(input())
S = input()
for i in range(N):
    if S[i]=='.':
        break
if S[i+1:].count('.')==0:
    ans = i + S[i+1:].count('#')
else:
    ans = i + max(0, min(S[i+1:].count('#'), S[i+1:].count('.')))
if S[-1]=='#':
    ans -= 1
print(ans)
