You are given an array consisting of n integer numbers \(a_1,a_2..a_n\). Two subarrays \([l_1
\space r_1]\) (\(1\le l_1\le r_1\le n\)) and \([l_2 \space r_2]\) (\(1\le l_2\le r_2\le 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 \(a_1,a_2..a_n\)
Output Format
Output the required answer.
Constraints
\(1\le n\le 1000\)
\(1\le a_i\le 1000 \)
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
Login to unlock the editorial