A sequence of numbers is said to be good if it satisfirs the following
x and the maximum elemnt in the sequence is y, then all the numbers in range [x,y] are present in sequence.Example
arr = [13, 11, 4, 12, 5, 4]
subseq of length 1 = [13, 11, 4, 12, 5, 4]
subseq of length 2 = [13,12],[11,12],[4,5],[5,4]
subseq of length 3 = [13,11,12]
answer = 6 + 4 + 1 = 11
Returns
An integer of good sequences.