Count subsequences of form [0..0,1..1,2..2] in array of 0/1/2, mod p.
Input: Integer array of 0/1/2.
Output: Integer.
Input: [0,1,2]
Output: 1
Explanation: Only [0,1,2].Input: [0,1,2,0,1,2]
Output: 7
Explanation: 7 ways.Input: [2,2,2]
Output: 0
Explanation: No 0s.0<=n<=10^5nums[i] in {0,1,2}