#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int n, ans, num, t, pos[maxn], eq[maxn];
int put[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t);
    num = max(t, num);
    if (eq[t] == -1) continue;
    if (!pos[t])
      pos[t] = i;
    else if (eq[t] == 0) {
      eq[t] = i - pos[t];
      pos[t] = i;
    } else if (i - pos[t] != eq[t]) {
      eq[t] = -1;
    } else
      pos[t] = i;
  }
  for (int i = 1; i <= num; i++)
    if (pos[i] && eq[i] != -1) {
      put[++ans] = i;
    }
  printf("%d\n", ans);
  for (int i = 1; i <= ans; i++) printf("%d %d\n", put[i], eq[put[i]]);
  return 0;
}
