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