n = int(input()) s = input() count = 0 news = s state = 0 for i in range(n): if state == 0: if news[i] == '0': state = 1 elif state == 1: if news[i] == '0': state = 2 count += 1 else: state = 2 elif state == 2: if news[i] == '0': count += 1 state = 0 else: state = 0 print(count)