import copy
N = int(input())
S = list(input())
 
S_1 = copy.copy(S)
S_2 = copy.copy(S)
S_3 = copy.copy(S)
S_4 = copy.copy(S)
count_1 = 0
count_3 = 0

for i in range(N-1):
  if S_1[i] == "#" and S_1[i+1] == ".":
    if i != N - 2:
      if S_1[i+2] == "#":
        S_1[i+1] = "#"
      elif i != 0 and S_1[i-1] == ".":
        S_1[i] = "."
      else:
        S_1[i+1] = "#"
    count_1 += 1
    
#for i in range(N-1):
#  if S_2[i] == "#" and S_2[i+1] == ".":
#    S_2[i] = "."
#    count_2 += 1
    
for i in range(N-1):
  if S_3[N - i - 1] == "." and S_3[N - i - 2] == "#":
    if i != N - 2:
      if S_3[N - i -3] == ".":
        S_3[N - i - 2] = "."
      elif i != 0 and S_3[N - i] == "#":
        S_3[N - i - 1] = "#"
      else:
        S_3[N - i - 2] = "."
    count_3 += 1
    
#for i in range(N-1):
#  if S_4[N - i - 1] == "." and S_4[N - i - 2] == "#":
#    S_4[N - i - 2] = "."
#    count_4 += 1
    
print(min(count_1, count_3))