Let us define a onto function F from A : [r1,r2 ... rn] to B: [1, 2,3] where r1, r2, . , rn, are the readings of n throws and 1, 2, 3 are the numbers that appear in the n throws.
Number of such functions, M = N - [n(1) -n(z)+ n(3)]
where N = total number of functions and n(t) = number of function having exactly t elements in the range.