import sys def solve(): n = int(sys.stdin.readline()) s = list(sys.stdin.readline().strip()) count = 0 i = 0 while i < n - 1: # "00" if i + 1 < n and s[i] == '0' and s[i+1] == '0': s[i+1] = '1' count += 1 # i+2 から i += 2 # "010" elif i + 2 < n and s[i] == '0' and s[i+1] == '1' and s[i+2] == '0': s[i+2] = '1' count += 1 # i+3 から i += 3 else: # マッチせず i += 1 print(count) if __name__ == "__main__": solve()