public static int removeDuplicates(int[] A) {
		int index = 0, move = 0, times = 1, cur = 0;
		for (; move < A.length;) {
			while (move + 1 < A.length && A[move] == A[move + 1]) {
				times++;
				move++;
			}
			if (times == 1) {
				A[index++] = A[cur++];
			} else {
				A[index++] = A[cur++];
				A[index++] = A[cur++];
			}
			times = 1;
			move++;
			cur = move;
		}
		return index;
	}