import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {
    private static int ans = 0, l, r;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        l = sc.nextInt();
        r = sc.nextInt();
        List<List<Integer>> tree = new ArrayList<>();
        for (int i = 0; i <= n; i++) tree.add(new LinkedList<>());
        for (int i = 2; i <= n; i++) {
            int f = sc.nextInt();
            tree.get(f).add(i);
        }
        postOrder(tree, 1);
        System.out.println(ans);
        sc.close();
    }

    private static int postOrder(List<List<Integer>> tree, int node) {
        int size = 1;
        for (int child : tree.get(node)) size += postOrder(tree, child);
        if (size >= l && size <= r) ans++;
        return size;
    }
}