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;
	}

}
package dancing;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Dance
{

	public static void main(String[] args) throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int count = Integer.parseInt(br.readLine());
		
		for(int i = 0;i < count;i++)
		{
			String[] info = br.readLine().split(" ");
			int n = Integer.parseInt(info[0]);
			int s = Integer.parseInt(info[1]);
			int p = Integer.parseInt(info[2]);
			
			int[] scores = new int[n];
			for(int j = 0;j < n;j++)
				scores[j] = Integer.parseInt(info[3 + j]);
			
			int maxCount = 0;

			int minS = p + 2 * (p - 2);
			int minN = p + 2 * (p - 1);
			
			//System.out.println(minS + " " + minN);
			
			for(int score : scores)
			{
				if(score == 0 && p != 0)
					continue;
				
				if(score >= minN)
				{
					maxCount++;
					continue;
				}
				
				if(score >= minS && s > 0)
				{
					maxCount++;
					s--;
					continue;
				}
			}
			
			System.out.println("Case #" + (i + 1) + ": " + maxCount);
		}
	}
	
}
