Problem Statement :
You are given an array A of N integers. You have to find the number of the magical array's that are a subarray of the given array.
A magical array is one which does not have distinct elements.
For example, [2 2 2], [1 1 1] are magical arrays while [2 2 2 3], [3 3 1 3] are not magical arrays.
Input format :
The first line contains one integer N — the number of elements in the array.
The second line contains N spaced integers A0,A1,A2,.....An−1 .
Output format :
Print one integer, the number of magical subarrays.
Constraints :
1≤N≤1051≤Ai≤109
Here, n = 4 and a = [5, 5, 4, 4].
So, The magical arrays are [5], [5], [4], [4], [5, 5], [4, 4].
The count of magical arrays is 6.