#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int n, act;
int t[MAXN];
int last[MAXN], len[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i < MAXN; ++i) len[i] = -1;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &t[i]);
    act = t[i];
    if (len[act] == -1) {
      len[act] = 0;
    } else if (len[act] >= 0) {
      if (len[act] == 0)
        len[act] = i - last[act];
      else if (i - last[act] != len[act])
        len[act] = -2;
    }
    last[act] = i;
  }
  int counter = 0;
  for (int i = 1; i < MAXN; ++i)
    if (len[i] >= 0) ++counter;
  printf("%d\n", counter);
  for (int i = 1; i < MAXN; ++i) {
    if (len[i] >= 0) {
      printf("%d %d\n", i, len[i]);
    }
  }
  return 0;
}
