public class Program { public static void Main() { //int num = int.Parse(Console.ReadLine() ?? string.Empty); //string[] str = (Console.ReadLine() ?? string.Empty).Trim().Split(' '); string str = Console.ReadLine() ?? string.Empty; //1000000007 元の数 int count = 0; for (int i = 0; i < str.Length; i++) { if (str[i] == '0') { count++; } } //〇の数の差計算して出力 if( 8 > count) { Console.WriteLine(8 - count); } else { Console.WriteLine(count - 8); } } }