/**
 * 
 */
package pandit.codejam;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Scanner;

/**
 * @author Manu Ram Pandit
 * 
 */
public class DancingWithGooglersUpload {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		FileInputStream fStream = new FileInputStream(
				"input.txt");

		Scanner scanner = new Scanner(new BufferedInputStream(fStream));
		Writer out = new OutputStreamWriter(new FileOutputStream("output.txt"));

		int T = scanner.nextInt();
		int N,S,P,ti;
		int counter = 0;
		for (int count = 1; count <= T; count++) {
			N=scanner.nextInt();
			S = scanner.nextInt();
			counter = 0;
			P = scanner.nextInt();
			for(int i=1;i<=N;i++){
				ti=scanner.nextInt();
				if(ti>=(3*P-2)){
					counter++;
					continue;
				}
				else if(S>0){
					if(P>=2 && ((ti==(3*P-3)) ||(ti==(3*P-4)))) {
					S--;
					counter++;
					continue;
					}
				}
				
			}
			// System.out.println("Case #" + count + ": " + counter);
			out.write("Case #" + count + ": " + counter + "\n");
		}
		fStream.close();
		out.close();

	}

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package codejam;

import java.io.*;
import java.util.Arrays;
import java.util.HashMap;

/**
 *
 * @author Ostap
 */
public class CodeJam {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws FileNotFoundException, IOException {

       
       BufferedReader bf = new BufferedReader(new FileReader("B-small-attempt0.in"));
       int n = Integer.parseInt(bf.readLine());
       PrintWriter pw = new PrintWriter(new FileWriter("output.txt"));
       
       for (int i = 0;i < n;i++){
           int count = 0;
           int uses = 0;
           String[] s = bf.readLine().split(" ");
           int N = Integer.parseInt(s[0]);
           int S = Integer.parseInt(s[1]);
           int p = Integer.parseInt(s[2]);
           
           for (int j = 0; j < N; j++) {
               int v = Integer.parseInt(s[j+3]);
               
               int a[] = new int[3];
               
               for (int k = 0; k < 2; k++) {
                   a[k] = v/(3-k);
                   v-=a[k];
               }
               
               a[2] = v;
               
               Arrays.sort(a);
               
               if (a[2] >= p){
                   count++;
                   continue;
               }
               
               if (uses < S){
                   if (a[2] == a[1] && a[1] !=0)
                       if (a[2]+1 >= p){
                           count++;
                           uses++;
                       }
                   
               }

               }
           
           pw.println("Case #"+(i+1)+": "+count);
           }
           
       
       
       pw.flush();;
       pw.close();
       
       
    }
}
