N = int(input())
S = input()
 
arr = [0] if S[0] == "." else []
count = 0
for i in range(len(S)):
  count += 1
  if S[i:i+2] == "#.":
    arr.append(count)
    count = 0  
  if S[i:i+2] == ".#":
    arr.append(count)
    count = 0
if S[-1] == ".":
  arr.append(count)
#print(arr)
 
result = sum([min(arr[i:i+2]) for i in range(0, len(arr)+1, 2)])
print(result)