I'll try to formulate my problem through an example. Lets suppose we have a collection of items of type a,b,c,d,e,f.
a1, a5, a7
c5, c6, c7, c8
e1, e2, e3
f3, f7, f8
If we take one element from each type there are 3*2*4*2*3*3 abcdef lines (combinations).
We have another random line a1b5c7d1e5f7.
I want to count how many from the combinations lines differ by the current line in exactly 3 elements. I.e these lines differ only in one (the first) element
I want to do that if it's possible without generating and comparing each combination.