using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ N=0; if(S.Length<4){ N=long.Parse(S); }else{ N=long.Parse(S.Substring(S.Length-4)); } int ans=0; switch(N){ case 4: ans=3;break; case 6: ans=5;break; case 8: ans=7;break; case 9: ans=7;break; case 10: ans=7;break; case 15: ans=7;break; case 16: ans=7;break; case 22: ans=7;break; case 20: ans=19;break; case 21: ans=19;break; case 14: ans=13;break; case 12: ans=11;break; case 33: ans=8;break; case 57: ans=8;break; case 65: ans=8;break; default: if(N%8==1){ ans=14; }else{ ans=8; }break; } Console.WriteLine(ans); } String S; long N; public Sol(){ S=rs(); } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(){return Console.ReadLine().Split(' ');} static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));} static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));} static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));} }