using System; using System.Linq; public class Hoge{ public static void Main(string[] args){ var line = Console.ReadLine(); var ar = line.ToCharArray(); var i = ar.Count(e=> e == '3'); if( i == 0 || i != line.Length -1){ Console.WriteLine("-1"); }else{ Console.WriteLine(i); } } }