public static int singleNumber2(int[] A) {
    	int res = 0;
    	int count = 0;
    	for (int i = 0; i < 32; i++) {
    		count = 0;
    		for (int j = 0; j < A.length; j++) {
    			if (1 == ((A[j] >> i) & 1)) count = count + 1;
    		}
    		res = res | ((count % 3) << i);
    	}
    	return res;
    }