content: package regionals.latinAmerica2015;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.util.StringTokenizer;
  
  public class IdentifyingTea {
  
  	public static void main(String[] args) throws NumberFormatException, IOException {
  		
  		Scanner sc = new Scanner(System.in);
  		PrintWriter out = new PrintWriter(System.out);
  		
  		while(sc.ready())
  		{
  			int t = sc.nextInt(), ans = 0;
  			for(int i = 0; i < 5; ++i)
  				if(sc.nextInt() == t)
  					++ans;
  			out.println(ans);
  		}
  		out.flush();
  		out.close();
  		
  	}
  	
  	static class Scanner
  	{
  		BufferedReader br;
  		StringTokenizer st;
  		
  		Scanner(InputStream s) { br = new BufferedReader(new InputStreamReader(s)); }
  		
  		String next() throws IOException
  		{
  			while(st == null || !st.hasMoreTokens())
  				st = new StringTokenizer(br.readLine());
  			return st.nextToken();
  		}
  		
  		int nextInt() throws NumberFormatException, IOException { return Integer.parseInt(next()); }
  		
  		boolean ready() throws IOException { return br.ready(); }
  	}
  }
  