from collections import deque N = int(input()) S = list(input()) cnt = 0 hoge = 3 q = deque(['1','1','1']) for c in S: #print(q,hoge) a = q.popleft() if a == '1': hoge -= 1 q.append(c) if c == '1': hoge += 1 if hoge < 2: q[2] = '1' hoge += 1 cnt += 1 print(cnt)