K-Distinct Windows


Given an array aa of nn integers, count how many contiguous subarrays of length exactly xx contain at least kk distinct values.

Input

The first line contains three integers nn, xx, and kk.

The second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n.

Output

Print a single integer: the number of contiguous subarrays of length exactly xx that contain at least kk distinct values.

Constraints

  • 1kxn21051 \le k \le x \le n \le 2 \cdot 10^5
  • 109ai109-10^9 \le a_i \le 10^9

Example 1

Input 1
8 4 3
1 1 2 3 2 2 1 4
Output 1
4
Explanation

The five subarrays of length 44 are:

  • [1,1,2,3][1, 1, 2, 3], which has 33 distinct values;
  • [1,2,3,2][1, 2, 3, 2], which has 33 distinct values;
  • [2,3,2,2][2, 3, 2, 2], which has 22 distinct values;
  • [3,2,2,1][3, 2, 2, 1], which has 33 distinct values;
  • [2,2,1,4][2, 2, 1, 4], which has 33 distinct values.

So the answer is 44.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.