Check if array elements are consecutive