import java.io.*; import java.util.*; public class moduic_inaba { public static void main( String[] _ ) throws IOException { StreamTokenizer st = new StreamTokenizer( new BufferedReader( new InputStreamReader(System.in))); for(;;) { int[] filled = new int[10]; for(int i=0; i<10; ++i) { st.nextToken(); filled[i] = (int) st.nval; if( filled[i] < 0 ) return; // 入力の終わり } System.out.println( count(filled) ); } } static int count( int[] sq ) { boolean[] used = new boolean[11]; for(int i=0; i