from sys import stdin

line = list(stdin.readline().strip())
if line[0] == '0':
	print(-1)
else:
	relocations = 0
	for i in range(len(line)):
		if line[i] == '0':
			relocations += 1
			new_line = line[:]
			for j in range(len(line)-i):
				if line[j] == '1':
					new_line[i+j] = '1'
			line = new_line
	print(relocations)
	
