I'm not the "math" guy so I probably would go easy way, and improve it on the go.
Create 14 placeholder sprites with instance variable "number" from 1 to 14 for each sprite. Then just do simple compare.
For objects going to inventory, would do variable "number" as well.
If you pick up an object add 1 to variable "number" and place it in
placeholder number 1 XY.
If you pick up another object add 1 to variable "number" and place it in placeholder number 2 XY ...
as I say, it's easy and rough method but should work. After you happy with that, it's time for improving :)