#include <bits/stdc++.h>   using namespace std;   int n, arr[100005], diff[100005], prv[100005];   bool flag[100005];   vector<int> a, d;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , arr + i);       flag[arr[i]] = 1;     }     for (int i = 1; i <= n; ++i) {       if (!flag[arr[i]]) continue;       if (prv[arr[i]] && !diff[arr[i]])         diff[arr[i]] = i - prv[arr[i]];       else if (prv[arr[i]] && diff[arr[i]] != i - prv[arr[i]])         flag[arr[i]] = 0;       prv[arr[i]] = i;     }     for (int i = 0; i < 100005; ++i)       if (flag[i]) a.push_back(i), d.push_back(diff[i]);     printf( %d n , a.size());     for (int i = 0; i < a.size(); ++i) printf( %d %d n , a[i], d[i]);     return 0;   }   