Complex problem involving two sets of number matrixes...

Hi I have 2 set of number matrixes...

for example (A set) 1 ,2 3 ...10 and (B set (1 2, 3, ....10)

My data is in the form :
(A set) (B set)

{2 3 5 7 9 10} { 3 5 6 8 9 10 }
{2 4 6 8 9 10 } {3 6 7 8 9 10 }
{ 3 5 6 7 8 10} { 1 3 5 7 8 9 } ETC

What I need is to count how many times each one to one relationships occurs and total them ?
in a final matrix

For example
(A set)(Bset)
2 3 = 3
2 4 =0
2 5 = 2
2 6 = 2
2 7 = 2
...etc

3 1 = 1
etc...

I am really stumped & ANY help would be much appreciated

thanks Dan