Jungyu has built a shuffle machine. To use it, place N cards numbered from 1 to N on the machine in order. The machine first reads the cards and prints their current order on a tape. Then it applies the given shuffle permutation, reads the cards again, and prints the next line. It repeats this process, applying the same shuffle before every later line.
After testing the machine, Jungyu found a torn piece of the output tape. On every line of this piece, the first C numbers and the last D numbers have been erased.
The unshuffled order is called the first sequence. Among the sequences from the A-th through the B-th, count how many have every remaining printed number equal to the corresponding number in the original unshuffled order.
The first line contains five integers N, A, B, C, and D (1 <= N <= 500000, A <= B <= 10^12, 0 <= C, D <= N, C + D < N).
The second line contains the shuffle permutation. Each integer from 1 to N appears exactly once. If the k-th integer is x, then during one shuffle the card currently in position k moves to position x.
Print the number of sequences Jungyu is looking for.