using System; public class Hello { public static void Main() { var s = Console.ReadLine().Trim(); var sL = s.Length; var hole = 0; foreach (var x in s) if (x == '0' | x == '4' | x == '6' | x == '9') hole += 1; else if (x == '8') hole += 2; var m1 = 2 + 2 * hole + sL; var m2 = 1 + hole + 2 * sL; Console.WriteLine(Math.Min(m1, m2)); } }