Gets the first n items of an array.