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.BufferedReader;
import java.io.File;
import java.io.FileReader;

public class Second {

	public static void main(String[] args) throws Exception {
		BufferedReader reader = new BufferedReader(new FileReader(new File(
				"/Users/narok119/Desktop/B-small-attempt1.in")));

		String txt = reader.readLine();
		int caseCount = 1;

		while ((txt = reader.readLine()) != null) {
			// Form the inputs
			String[] info = txt.split(" ", 4);
			int n = Integer.parseInt(info[0]);
			int s = Integer.parseInt(info[1]);
			int p = Integer.parseInt(info[2]);
			String[] input = info[3].split(" ");
			int[] number = new int[n];
			int output = 0;
			for (int i = 0; i < n; i++) {
				number[i] = Integer.parseInt(input[i]);
			}

			// Start calculating output
			for (int i = 0; i < n; i++) {
				if (p * 3 <= number[i]) {
					output++;
				} else if (2 * p + (p - 1) == number[i]) {
					output++;
				} else if (2 * (p - 1) + p == number[i]) {
					output++;
				} else if (s > 0 && p - 2 >= 0
						&& (p - 2) + (p - 1) + p == number[i]) {
					output++;
					s--;
				} else if (s > 0 && p - 2 >= 0 && (p - 2) + 2 * p == number[i]) {
					output++;
					s--;
				} else if (s > 0 && p - 2 >= 0 && 2 * (p - 2) + p == number[i]) {
					output++;
					s--;
				}
			}
			System.out.println("Case #" + caseCount++ + ": " + output);
		}
	}

}
