#include <bits/stdc++.h>
using namespace std;
struct node {
  int u, w, next;
} edge[1000001];
int t;
int p[100001];
int first[100001];
int flag[100001];
void CL() {
  t = 0;
  memset(first, -1, sizeof(first));
}
void add(int u, int w) {
  edge[t].u = u;
  edge[t].w = w;
  edge[t].next = first[u];
  first[u] = t++;
}
int judge(int x) {
  int pre, pos, i;
  pre = first[x];
  if (edge[pre].next == -1) return 0;
  pos = edge[pre].w - edge[edge[pre].next].w;
  for (i = pre; edge[i].next != -1; i = edge[i].next) {
    if (pos != edge[i].w - edge[edge[i].next].w) return -1;
  }
  return pos;
}
int main() {
  int n, i;
  scanf("%d", &n);
  CL();
  for (i = 0; i < n; i++) {
    scanf("%d", &p[i]);
    add(p[i], i);
  }
  int ans = 0;
  for (i = 1; i <= 100000; i++) {
    if (first[i] == -1) continue;
    if (judge(i) != -1) ans++;
  }
  printf("%d\n", ans);
  for (i = 1; i <= 100000; i++) {
    if (first[i] == -1) continue;
    int temp;
    if ((temp = judge(i)) != -1) printf("%d %d\n", i, temp);
  }
  return 0;
}
