Given an array of numbers, you can choose to swap the sequence of a number with its neighbours at each time. Find the least actions required to generate the longest consecutive numbers.
Example:
Input: [1, 2, 3, 2]
Output: 1, the final list can be [1, 2, 2, 3] and there are two consecutive 2.
Input: [1, 3, 1, 2, 2, 1, 5, 4, 3, 2]
Output: 3, the final list can be [3, 1, 1, 1, 2, 2, 5, 4, 3, 2] and there are three consecutive 1
Input: [1, 2, 3, 4]
Output: 0