You are participating in a game show. In the final round, the host pulls up a large sequence of positive integers. And he asks you to count the number of non-empty subsequences of this sequence such that the subsequences have at most two distinct numbers. A subsequence of a sequence is created by erasing zero or more elements. For example [3,5,6][3, 5, 6][3,5,6] is a subsequence of [1,2,3,4,5,6][1, 2, 3, 4, 5, 6][1,2,3,4,5,6]. The clock is ticking, the host is waiting, can you give him the answer? Since the answer can be large, even larger than a 64-bit integer, you have to divide that by 109+710^9+7109+7 and output the remainder. This is also known as the modulo operator.
This is a companion discussion topic for the original entry at https://toph.co/p/bi-element-subsequence