Nissy likes Arithmetic Progression. He sees an array of integers a1,a2,...,an of length n. He wants to find all values of x satisfying these conditions:
x occurs in the array
Consider the positions/indices of occurrence of number x in the array and on sorting these positions/indices in the ascending order, they must form an arithmetic progression.
But Nissy can’t find them all on his own. He needs your help in finding them.
Input Format:
First Line: An integer n
The next line contains integers a1,a2,...,an separated by spaces.
Output Format:
In the first line print an integer t = the total number of valid x.
On each of the next t lines print two space-separated integers x and dx, where x is the value and dx is the common difference between the positions/indices of occurrences in the progression(if x occurs exactly once in the sequence, dx must equal 0). Print the pairs in the order of increasing x.
Constraints:
1≤n≤105
1≤ai≤105