import bisect n = int(input()) s = input().strip() pos = [i for i in range(n) if s[i] == '0'] m = len(pos) if m <= 1: print(0) else: dp = [0] * m dp[0] = 1 for i in range(1, m): target = pos[i] - 3 j = bisect.bisect_right(pos, target) - 1 if j >= 0: current = dp[j] + 1 else: current = 1 dp[i] = max(dp[i-1], current) print(m - dp[-1])