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.util.*;
import java.io.*;

public class B {
	public static void main(String[] args) {
		int n = 0;
		int[] m = null;
		int[] s = null;
		int[] p = null;
		int[][] t = null;
		try {
			File file = new File(args[0]);
			Scanner sc = new Scanner(file);
			n = sc.nextInt();
			m = new int[n];
			s = new int[n];
			p = new int[n];
			t = new int[n][];
			for(int i=0;i<n;i++) {
				m[i] = sc.nextInt();
				s[i] = sc.nextInt();
				p[i] = sc.nextInt();
				t[i] = new int[m[i]];
				for(int j=0;j<m[i];j++) {
					t[i][j] = sc.nextInt();
				}
			}
		} catch(FileNotFoundException e) {
			e.printStackTrace();
		}

		for (int i=0;i<n;i++) {
			int b1 = p[i] * 3 - 2;
			int b2 = p[i] * 3 - 4;
			int good = 0;int suprise = 0;
			for (int j=0;j<m[i];j++) {
				if (t[i][j] < p[i]) { continue; }
				if (t[i][j] >= b1) {
					good++;
				} else if (t[i][j] >= b2) {
					suprise++;
				}
			}
			int res;
			if (suprise > s[i]) {
				res = good + s[i];
			} else {
				res = good + suprise;
			}
			System.out.println("Case #" + (i+1) + ": " + res);
		}
	}
}
