private int count(int x, int Y[],Map<Integer,Integer> hardCount){
        
        if(x == 0){
            return 0;
        }
        if(x == 1){
            return upperBound(0,Y);
        }
        int result = Y.length - upperBound(x,Y);
        result +=  (hardCount.containsKey(1) ? hardCount.get(1) : 0 ) + (hardCount.containsKey(0) ? hardCount.get(0) : 0);
    
        if(x == 2){
            result -= (hardCount.containsKey(3)  ? hardCount.get(3) : 0);
        }
        if(x == 3){
            result += (hardCount.containsKey(2)  ? hardCount.get(2) : 0);
        }
        return result;
    }
http://www.geeksforgeeks.org/find-number-pairs-xy-yx/
src/com/interview/binarysearch/NumberOfPairWithXPowerYGreaterThanYPowerX.java