S = input() ret = 0 n1 = 0 for c in S: if c == '1': n1 += 1 else: ret += n1 // 2 n1 -= n1 % 2 print(ret)