You are given a sequence of integers .
In one operation, delete two adjacent entries with equal values, preserving the order of all other entries.
Find the number of distinct sequences attainable after zero or more operations, modulo . Include the empty sequence if it is attainable. Sequences are distinct if they differ in length or in any entry.
For each test case, output the number of distinct reachable sequences modulo .
The reachable sequences are , , and the empty sequence.
The reachable sequences are , , , , , , and the empty sequence.
There is one reachable sequence of each length .