import java.util.List;


public class Case implements Runnable {

	private int id;
	private String output;

	private int n;
	private int s;
	private int p;
	private List<Integer> g;

	public Case(int id) {
		this.id = id;
	}

	public Case(int id, int n, int s, int p, List<Integer> g) {
		super();
		this.id = id;
		this.n = n;
		this.s = s;
		this.p = p;
		this.g = g;
	}

	public String solve() {
		int res = 0;
		for (int googler : g) {
			int b = googler / 3;
			boolean div = googler % 3 == 0;
			if (b >= p) {
				res++;
				continue;
			}
			if (p == b+1) {
				if (div && s > 0 && b > 0) {
					res++;
					s--;
					continue;
				}
				if (!div) {
					res++;
					continue;
				}
			}
			if (p == b+2) {
				if (3*b+2 == googler && s > 0) {
					res++;
					s--;
				}
			}
		}
		return String.valueOf(res);
	}

	@Override
	public void run() {
		output = solve();
	}

	@Override
	public String toString() {
		return "Case #" + id + ": " + output;
	}

}
import java.io.*;
import java.util.Scanner;


public class DancingGoogler {

	static String outputFile, inputFile;
	public static void main(String[] args) throws IOException  {
		if (args.length != 2)
			return;
		inputFile = args[0];
		outputFile = args[1];

		// Create FileReader Object
		FileReader inputFileReader = new FileReader(inputFile);
		FileWriter outputFileReader = new FileWriter(outputFile);

		// Create Buffered/PrintWriter Objects
		BufferedReader inputStream = new BufferedReader(inputFileReader);
		PrintWriter outputStream = new PrintWriter(outputFileReader);
		
		Scanner scanner;
		String inLine = null;
		int cases = Integer.parseInt(inputStream.readLine().trim());
		
		int num, surprising, score;
		int[] scores;
		for (int i = 1; i < cases + 1; i++) {
			inLine = inputStream.readLine().trim();
			scanner = new Scanner(inLine);
			num = scanner.nextInt();
			surprising = scanner.nextInt();
			score = scanner.nextInt();
			scores = new int[num];
			for (int j=0; j<num; j++){
				scores[j] = scanner.nextInt();
			}
			outputStream.println("Case #"+i+": "+getBestDancers(scores, surprising, score));
		}
		
		outputStream.close();

	}
	
	private static int getBestDancers(int[] scores, int surprising, int targetSc ){
		int totalTarget = 3*targetSc;
		int numBest = 0;
		if (totalTarget==0) return scores.length;
		
		for (int i=0; i<scores.length; i++){
			if (scores[i]>= totalTarget-2) numBest++;
			else if (totalTarget > 3 && scores[i] >= totalTarget-4 ) {
				if (surprising>0){
					numBest++;
					surprising--;
				}
			}
		}
		return numBest;
	}

}
