Convert array [1,2,3,4,5,6,7,8] into [2,1,4,3,6,5,8,7]. Note edge case where number of elements are odd.