import sys input = sys.stdin.readline def main(): N = int(input()) S = input().strip() INF = 10**18 dp = {(1, 1): 0} for c in S: ndp = {} for (l2, l1), cost in dp.items(): for out, add in ((0, 0), (1, 1)) if c == '0' else ((1, 0),): if l1 == 0 and out == 0: continue if l2 == 0 and l1 == 1 and out == 0: continue nc = cost + add key = (l1, out) if nc < ndp.get(key, INF): ndp[key] = nc dp = ndp ans = min(dp.values()) print(ans) if __name__ == "__main__": main()