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