Ali has an array of $n$ distinct numbers.
He wants to calculate the sum of F(L, R), where F(L, R) is the mex of the numbers in the subarray [L, R] (0 <= L <= R <= n-1).
Knowing that the mex of an array is the minimum excluded number (mex(1,2) = 0, mex(0,1,2)= 3).
Can you help Ali to find the sum of F(L, R) for all subarrays?