Given a sequence A of N integers, find the number of strictly increasing subsequences, modulo 109 + 7.
The first line of input will contain a single integer, N.
The second line of input will contain N integers, representing the sequence A.
The output should contain one line with one integer, the number of strictly increasing subsequences, modulo 109 + 7.
Subtask 1 (30%): 1 ≤ N ≤ 103, 1 ≤ Ai ≤ 103.
Subtask 2 (10%): 1 ≤ N ≤ 106, Ai = i + 1. (A will be 1...N)
Subtask 3 (24%): 1 ≤ N ≤ 106, 1 ≤ Ai ≤ 106.
Subtask 4 (36%): 1 ≤ N ≤ 106, 1 ≤ Ai ≤ 109.
Subtask 5 (0%): Sample Testcases.
4 1 2 3 4
15
5 1 6 2 4 3
13
Subtask | Score |
---|---|
1 | 30 |
2 | 10 |
3 | 24 |
4 | 36 |
5 | 0 |