N=  int(input())
A = input()
A = list(A)
l = [0]
s = []
for i in range(N-1):
    if A[i] != A[i+1]:
        l.append(i+1)
        s.append(l[len(l)-1]-l[len(l)-2])
l.append(N)
s.append(l[len(l)-1]-l[len(l)-2])
sum = 0
if A[0]=="#":
    if len(s)%2==1:
        s.append(0)
    for i in range(0,len(s)-1,2):
        sum += min(s[i],s[i+1])
else:
    if (len(s)-1)%2==1:
        s.append(0)
    for i in range(1,len(s)-1,2):
        sum += min(s[i],s[i+1])
print(sum)