package util.graph;

import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Set;

public class DynDjikstra {
    public static State FindShortest(Node start, Node target) {
        PriorityQueue<Node> openSet = new PriorityQueue<>();
        Set<Node> closedSet = new HashSet<>();
        openSet.add(start);
        while (!openSet.isEmpty()) {
            Node current = openSet.poll();
            for (Edge edge : current.edges) {
                Node end = edge.target;
                if (closedSet.contains(end)) {
                    continue;
                }
                State newState = edge.travel(current.last);
                //if (end.equals(target)) {
                    //return newState;
                //}
                if (openSet.contains(end)) {
                    if (end.last.compareTo(newState)>0) {
                        end.last = newState;
                    }
                } else {
                    openSet.add(end);
                    end.last = newState;
                }
            }
            closedSet.add(current);
            if (closedSet.contains(target)) {
                return target.last;
            }
        }

        return target.last;
    }
}

package gcj2012.qual;


import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;

import common.AbstractRunner;
import common.AbstractRunner.SIZE;

public class B extends AbstractRunner {
	
	public void handleCase(int caseNumber) throws Exception {
		int n = scanner.nextInt();
		int s = scanner.nextInt();
		int p = scanner.nextInt();
		
		//if (p == 0)
		
		int res = 0;		
		for (int i=0; i<n; i++) {
			int x = scanner.nextInt();
			x -= p;
			if (x >= 0) {
				if (2*(p-1) <= x) res++;
				else if (s > 0 && 2*(p-2) <= x) {
					s--;
					res++;
				}
			}
		}
		out.write(Integer.toString(res)+"\n");
	}

	public static void main(String[] args) throws Exception {
		new B().init(SIZE.small).execute();
	}
		
}
