import java.util.Scanner;
import java.io.*;
class dance
{
  public static void main (String[] args) throws IOException
  { 
    File    inputData = new File("B-small-attempt0.in");
	File 	outputData= new File("Boutput.txt");
    Scanner scan = new Scanner( inputData );
	PrintStream print= new PrintStream(outputData);
    
	int t;
	int n,s,p,pi;
	t= scan.nextInt();
	for(int i=1;i<=t;i++)
	{
	n=scan.nextInt();	s=scan.nextInt();	p=scan.nextInt();
	int supTrip=0, notsupTrip=0;
	
	for(int j=0;j<n;j++)
	{
		pi=scan.nextInt();
		if(pi>(3*p-3))
		notsupTrip++;
		else if((pi>=(3*p-4))&&(pi<=(3*p-3))&&(pi>p))
		supTrip++;
	}
	
	if(s<=supTrip)
	notsupTrip=notsupTrip+s;
	else if(s>supTrip)
	notsupTrip= notsupTrip+supTrip;
	print.println("Case #"+i+": "+notsupTrip);
	}
  }
}
package codejam;

import java.util.*;
import java.io.*;

public class DancingWithTheGooglers {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new FileReader("in.txt"));
		PrintWriter out = new PrintWriter(new File("out.txt"));
		
		int T = Integer.parseInt(in.readLine());
		for (int t = 1; t <= T; ++t) {
			String[] parts = in.readLine().split("[ ]+");
			int N = Integer.parseInt(parts[0]);
			int S = Integer.parseInt(parts[1]);
			int p = Integer.parseInt(parts[2]);
			int[] scores = new int[N];
			
			for (int i = 0; i < N; ++i)
				scores[i] = Integer.parseInt(parts[3 + i]);
			
			int max = 0;
			for (int i = 0; i < (1 << N); ++i) {
				if (Integer.bitCount(i) == S) {
					int cnt = 0;
					for (int j = 0; j < N; ++j) {
						int mod = scores[j] % 3;
						int score = scores[j] / 3;
						if (mod == 1 || mod == 2)
							++score;
						if ((i & (1 << j)) != 0) { // if surprising
							if (scores[j] > 1 && (mod == 0 || mod == 2))
								++score;
						}
						score = Math.min(score, 10);
						if (score >= p)
							++cnt;
						//System.out.println(score);
					}
					max = Math.max(max, cnt);
				}
			}
			
			out.println("Case #" + t + ": " + max);
		}
		
		in.close();
		out.close();
		System.exit(0);
	}
}
