n = int(input()) s = input().strip() res = 0 i = 0 while i < n: if s[i] == '0': j = i while j < n and s[j] == '0': j += 1 length = j - i res += (length + 1) // 2 i = j else: i += 1 print(res)