You are given an array consisting of n integer numbers a1,a2..an. Two subarrays [l1 r1] (1≤l1≤r1≤n) and [l2 r2] (1≤l2≤r2≤n) are considered the same if they have the same "special set" of numbers. Output the number of distinct subarrays.
Note: A "special set" of numbers is a set of unique numbers sorted in increasing order.For example,the "special set" corresponding to the numbers [5,2,7,2,5,9] is [2,5,7,9].
Input Format
First line contains n denoting the number of array elements.
Second line contains n integers denoting a1,a2..an
Output Format
Output the required answer.
Constraints
1≤n≤1000
1≤ai≤1000
Special Set of numbers in subarray [1 1]: {1}
Special Set of numbers in subarray [2 2]: {1}
Special Set of numbers in subarray [3 3]: {2}
Special Set of numbers in subarray [1 2]: {1}
Special Set of numbers in subarray [1 3]: {1,2}
Special Set of numbers in subarray [2 3]: {1,2}
Thus the number of distinct subarrays are 3.