stones_count = int(input())
input_str = input()

target = input_str[0]

def set_next_target(target_char):
  if target_char == '#':
    return '.'
  else:
    return '#'

stones = ''
stones_list = []

for i in range(stones_count):
  if input_str[i] == target:
    stones = stones + target
  else:
    stones_list.append(stones)
    target = set_next_target(target)
    stones = target

stones_list.append(stones)
#print(stones_list)

count_0 = 0
count_1 = 0

## ケース: .. or ## の場合、変換は不要
elif len(stones_list) == 1 :
  print(0)
  exit()
## ケース: ..## の場合、変換は不要
elif len(stones_list) == 2 and '#' in stones_list[-1]:
  print(0)
  exit()
## ケース: ..##..##.. の場合、先頭の要素を除いたもので少ない方のみ変換すればよい
else:
  for i in range(1, len(stones_list)):
    if i % 2 == 0:
     count_0 += len(stones_list[i])
    else:
     count_1 += len(stones_list[i])

if count_0 > count_1:
  print(count_1)
else:
  print(count_0)