#include <bits/stdc++.h>
using namespace std;
int arr[100100] = {0}, arr1[100100] = {0}, arr2[100100] = {0},
    arr4[100100] = {0};
int main() {
  int i, j, k, l, m, n;
  int T, M, N, K, t1, t2, t3, t4, t5;
  long long ans, out;
  cin >> N;
  t2 = 0;
  for (i = 1; i <= N; ++i) {
    scanf("%d", &t1);
    if (arr[t1] == 0) {
      arr[t1] = 1;
      arr1[t1] = 0;
      arr2[t1] = i;
      arr4[t1] = 1;
      t2++;
    } else {
      if (arr4[t1] != 0) {
        if (arr1[t1] == 0) {
          arr1[t1] = i - arr2[t1];
          arr2[t1] = i;
        } else {
          if (arr1[t1] == (i - arr2[t1])) {
            arr2[t1] = i;
          } else {
            arr4[t1] = 0;
            t2--;
          }
        }
      }
    }
  }
  cout << t2 << endl;
  for (i = 1; i <= 100000; ++i) {
    if (arr4[i] == 1) {
      printf("%d %d\n", i, arr1[i]);
    }
  }
  return 0;
}
