You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.
A non-empty subarray is a contiguous segment $$$a_l,a_{l+1},\ldots,a_r$$$ for some $$$1 \le l \le r \le n$$$. It is called good if its minimum element occurs an odd number of times within it.
Find the number of good subarrays of $$$a$$$.
The first line contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^5$$$) — the number of test cases.
Each test case consists of two lines.
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the array.
The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$1 \le a_i \le n$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, print one integer — the number of good subarrays.
441 3 1 221 153 4 2 5 2109 2 5 3 5 7 5 4 3 2
821250