In a sequence of positive integers, a inversion is a pair of positions, where the number in left is greater than the number in right. For example in the sequence $2, 5, 3, 1, 3$ has $5$ inversions{(5,1),(3,1),(5,3),(2,1),(5,3)}. Find the greatest number of inversions in a sequence where the sum of elements is $n$ a) where $n=7$ b) where $n=2019$