- Time limit: 1.00 s
- Memory limit: 512 MB
You are given an array of integers. Your task is to count the number of ways to split the array into continuous segments such that all segments consists of distinct values.
Input
The first line has an integers : the size of the array.
The next line has integers : the contents of the array.
Output
Print one integer: the answer to the problem modulo .
Constraints
Example
Input:
4 1 2 1 3
Output:
6
Explanation: There are six valid splits: