Let $S$ be the set of all ordered triples of integers $(a_1,a_2,a_3)$ with $1\le a_1,a_2,a_3\le 10$. Each ordered triple in $S$ generates a sequence according to the rule $a_n=a_{n-1}\cdot|a_{n-2}-a_{n-3}|$ for all $n\ge 4$. Find the number of such sequences for which $a_n=0$ for some $n$.