Modified the length of the array according to user input