using System; class Program { const int ZERO_COUNT = 8; static void Main(string[] args) { var input = Console.ReadLine(); var zeros = input.TrimStart('1').TrimEnd('7'); Console.WriteLine(Math.Abs(ZERO_COUNT - zeros.Length)); } }