- Time limit: 1.00 s
- Memory limit: 512 MB
Given an array of integers, count the number of subsequences where each element is dictinct.
A subsequence is a sequence of array elements from left to right that may have gaps.
Input
The first line has an integer : the array size.
The second line has integers : the array contents.
Output
Print the number of subsequences with distinct elements. The answer can be large, so print it modulo .
Constraints
Example
Input:
4 1 2 1 3
Output:
11
Explanation: The subsequences are (two times), , , , (two times), , , and .