public int removeDuplicates(int[] A) {
		int n = A.length;
		if (n == 0)
			return 0;
		if (n == 1)
			return 1;
		int cur = A[0];
		int count = 1;
		boolean flag = false;
		for (int i = 1; i < n; i++) {
			if (A[i] != cur) {
				cur = A[i];
				A[count] = cur;
				count++;
				flag = false;
			} else if (flag == false) {
				A[count] = cur;
				count++;
				flag = true;
			}
		}
		return count;
	}