public int singleNumber(int[] A) {
       if(A.length==1) return A[0];
       int count[] = new int[32];
       int i;
       
       for( i = 0;i<A.length;i++)
       {
    	   int j =0;
    	   int temp = A[i];
    	   while(j<32)
    	   {
    		   if((temp>>j & 1)==1)
    			   count[j] = (count[j]+1)%3 ;
    		   j++;
    	   }
       }
       int rt = 0;
       
       for( i = 0 ;i< 31;i++)
       {
    	   	if(count[i]>0)
    	   		rt = rt + count[i] * (1<<i);
       }
       if(count[i]==1) return rt- Integer.MAX_VALUE-1;
       return rt;
       
    }