#include <bits/stdc++.h>
using namespace std;
int a[111111], b[111111], t[111111];
int i, j, n, m;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> m;
    if (a[m] == 0) {
      a[m] = i;
      continue;
    }
    int k = i - a[m];
    a[m] = i;
    if (b[m] == 0) {
      b[m] = k;
      continue;
    }
    if (b[m] != k) t[m] = 1;
  }
  int tp = 0;
  for (i = 0; i < 100010; i++)
    if (a[i] && !t[i]) tp++;
  cout << tp << endl;
  for (i = 1; i < 100010; i++)
    if (a[i] && !t[i]) printf("%d %d\n", i, b[i]);
}
