import java.util.*;

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        B th = new B();
        for (int i = 0; i < T; i++) {
            int n = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();
            int[] t = new int[n];
            for (int j = 0; j < n; j++) {
                t[j] = sc.nextInt();
            }
            int c = th.getAnswer(s,p,t);
            System.out.println("Case #" + (i+1) + ": " + c);
        }
    }
    public int getAnswer(int s, int p, int[] t) {
        int A1 = p + p-1+p-1;
        int A2 = p + p-2+p-2;
        if (A1 < 0)
            A1 = 0;
        if (A2 < 0)
            A2 = 1;
        int remain = s;
        int count = 0;
        int n = t.length;
        for (int i = 0; i < n; i++) {
            if (t[i] >= A1) {
                count++;
            } else if (t[i] < A1 && t[i] >= A2) {
                if (remain > 0) {
                    remain--;
                    count++;
                }
            }
        }
        return count;
    }
}


package dancing;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class Main {

	public static void main(String[] args) throws IOException {
		File file = new File("B-large.in");
		FileReader fr = new FileReader(file);
		BufferedReader in = new BufferedReader(fr);

		String line = in.readLine();
		String[] tokens;
		int num = Integer.parseInt(line);
		int i = 1, N, s, p, t, minAlways, minSurprising, always, surprising, finalCount;
		while (i <= num) {
			line = in.readLine();
			tokens = line.split(" ");
			N = Integer.parseInt(tokens[0]);
			s = Integer.parseInt(tokens[1]);
			p = Integer.parseInt(tokens[2]);
			if (p >= 2) {
				minAlways = 3 * p - 2;
				minSurprising = 3 * p - 4;
			} else {
				minAlways = p;
				minSurprising = 1;
			}

			always = 0;
			surprising = 0;

			for (int j = 0; j < N; j++) {
				t = Integer.parseInt(tokens[3 + j]);
				if (t >= minAlways) {
					always++;
				} else if (t >= minSurprising) {
					surprising++;
				}
			}

			finalCount = always + Math.min(s, surprising);

			System.out.println("Case #" + i + ": " + finalCount);
			i++;
		}
	}

}
