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.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 * User: elbek
 * Date: 4/13/12
 * Time: 9:51 PM
 * To change this template use File | Settings | File Templates.
 */
public class Task2 {

    static Map<Character, Character> map = new HashMap<Character, Character>();

    public static void main(String[] args) {

        int t = 100;

        Scanner scanner = new Scanner(System.in);
        for (int q = 0; q <= t; q++) {
            String str = scanner.nextLine();
            String[] arg = str.split(" ");
            int googler = Integer.valueOf(arg[0]);
            int suprising = Integer.valueOf(arg[1]);
            int condition = Integer.valueOf(arg[2]);
            int found = 0;

            for (int i = 3; i < googler + 3; i++) {
                int sum = Integer.valueOf(arg[i]);
                int del = sum / 3;

                if (condition == 0) {
                    found++;
                    continue;
                }

                if (condition == 1 && sum >= 1) {
                    found++;
                    continue;
                }

                if (sum < 2)
                    continue;

                if (3 * condition - 4 <= sum && sum < 3 * condition - 2) {

                    if (suprising == 0)
                        continue;

                    suprising--;
                    found++;
                } else {
                    if (sum >= 3 * condition - 2)
                        found++;
                }
            }
            System.out.println("Case #" + (q + 1) + ": " + found);
        }
    }
}
