Count number of triplets with product equal to given number.Cann anyone suggest better solution than O(n^2)