The Normal Type
Practice
3.6 (128 votes)
Easy
Pointer
Searching
Sets
Problem
88% Success 19177 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

There are a lot of Poke'mons who are jealous of the fact that they do NOT have any specialty, they're the... normal type of Poke'mon. But, what they fail to realize is that their power is their normalcy, the ability to think, rationalize and then act.

But, they do have an additional power... Poke'mons like Jigglypuff - which are normal, can figure out if a trainer is real or is a part of Team Rocket. And they need to use their power to a great extent.

In an array, which consists of N elements, A1, A2, ..., AN, if a subarray has the total number of distinct elements as that of the original array, that determines the presence of Team Rocket.

You've to help the normal type Poke'mons in figuring out the total number of subarrays having total number of distinct elements same as that of the original array.

Input format:
The first line of the input will consist of a single integer N. The next line will consist of N integers A1, A2, ... , AN.

Output format: Output the answer to the problem.

Constraints:
1 ≤ N ≤ 2 * 105
1 ≤ Ai ≤ 109

Reference:
enter image description here

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
135 votes
Tags:
AlgorithmsEasySearchingdifferentiation
Points:30
20 votes
Tags:
AlgorithmsLinear SearchSimulation
Points:30
102 votes
Tags:
EasySearching