count pairs with sum ( x - current . data ) in the range first to last and add it to the ' count ' of triplets
count , current = count + countPairs ( first , last , x - current . data ) , current . next NEW_LINE