N = int(input())
S = input()

count = 0
counts = []
prev = "."
for i in range(N):
  if S[i] != prev:
    counts.append(count)
    count = 0
    
  if S[i] == ".":
    count += 1
  if S[i] == "#":
    count += 1
    
  prev = S[i]
counts.append(count)

res = 0
for i in range(len(counts)):
  if i % 2 == 1:
    if counts[i] < counts[i+1]:
      res += counts[i]
    else:
      res += counts[i+1]
      
res = 0
cursor = 1
while cursor <= len(counts)-2:
  if cursor % 1 == 1:
    if counts[cursor] < counts[cursor+1]:
      res += counts[cursor]
      counts = counts[:cursor-1] + [counts[cursor-1] + counts[cursor] + counts[cursor+1]] + counts[cursor+2:]
    else:
      res += counts[cursor]
      if cursor == len(counts)-2:
        counts = counts[:cursor-1] + [counts[cursor] + counts[cursor+1]]
      else:
        counts = counts[:cursor-1] + [counts[cursor] + counts[cursor+1] + counts[cursor+2]] + counts[cursor+3:]
        
print(res)