A shelf holds n products in a row, each given by a product id. Let D be the number of distinct product ids on the whole shelf. Count how many contiguous subarrays contain all D distinct ids (a complete subarray). Distinct index ranges are counted separately.
Input format
Line 1: an integer n.
Line 2: n space-separated integers, the product ids in order.
Output format
A single integer: the number of complete contiguous subarrays.
Constraints
- 1 <= n <= 40
- 1 <= each product id <= 1000000