N = int(input())
S = list(input())
xx = []
ten = []
count = 0#最初
count1 = 0 
count2 = 1
count3 = 0

for i in S:
    if i=="#" and count==0:
        count1 += 1
        count = 1
    elif i =="#" and count2==1 and count==1:
        count1 += 1
    elif i =="." and count2==1 and count==1:
        xx.append(count1)
        count1 = 1
        count2 = 0
    elif i =="." and count2==0 and count==1:
        count1 += 1
    elif i=="#" and count2==0 and count==1:
        ten.append(count1)
        count1 = 1
        count2 = 1

if count2==0 and count1>=1:
    ten.append(count1)

for i in range(len(xx)):
    if xx[i]>=ten[i]:
        count3 += ten[i]
    else:
        count3 += xx[i]

print(count3)