Given an array of integers, remove all adjacent duplicates. Three items in a row, such as [2,2,2,1] is considered 2 pairs of duplicates, and should change to [1]. Return the new size of the array.