n = int(input())
s = input()

pre_i = ''
res = 0
flag = 0
start_index = 0

for i in range(n):
      
    if flag == 1 and s[i] != '.':
      ver_s = s[start_index:i]
      black = ver_s.count('#')
      white = ver_s.count('.')
      res += white if white < black else black
      
      start_index = i
      pre_i = '.' if white < black else '#'
      flag = 0
      
    if s[i] == '.' and pre_i == '#':
      
      flag = 1
      
    else:
    	pre_i = s[i]
    
      
      
if flag == 1:
      ver_s = s[start_index:]
      black = ver_s.count('#')
      white = ver_s.count('.')
      res += white if white < black else black
     
print(res)