/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package codejam.common;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Lance Chen
 */
public class CodeHelper {

    private static String FILE_ROOT = "D:/workspace/googlecodejam/meta";

    public static List<List<String>> loadInputsExcludes(String fileName) {
        List<List<String>> result = new ArrayList<List<String>>();
        List<String> lines = FileUtil.readLines(FILE_ROOT + fileName);
        int index = 0;
        for (String line : lines) {
            if (index == 0) {
                index++;
                continue;
            }
            if (index % 2 == 1) {
                index++;
                continue;
            }
            List<String> dataList = new ArrayList<String>();
            String[] dataArray = line.split("\\s+");
            for (String data : dataArray) {
                if (data.trim().length() > 0) {
                    dataList.add(data);
                }
            }
            result.add(dataList);
            index++;
        }
        return result;
    }

    public static List<List<String>> loadInputs(String fileName) {
        List<List<String>> result = new ArrayList<List<String>>();
        List<String> lines = FileUtil.readLines(FILE_ROOT + fileName);
        for (String line : lines) {
            List<String> dataList = new ArrayList<String>();
            String[] dataArray = line.split("\\s+");
            for (String data : dataArray) {
                if (data.trim().length() > 0) {
                    dataList.add(data);
                }
            }
            result.add(dataList);
        }
        return result;
    }

    public static List<String> loadInputLines(String fileName) {
        return FileUtil.readLines(FILE_ROOT + fileName);
    }

    public static void writeOutputs(String fileName, List<String> lines) {
        FileUtil.writeLines(FILE_ROOT + fileName, lines);
    }
}

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

}
