Given an integer n, fill an array containing 1 2 2 3 3 3 4 4 4 4 ... and finally n repeated n times. Be sure not to fill past the end of the array. Return the number of elements filled.