#include <bits/stdc++.h>
using namespace std;
const int nm = 100002;
int n;
vector<int> vt[nm];
int nkq, kq[nm][2];
void nhap() {
  scanf("%d", &n);
  int i, a;
  for (i = 1; i <= n; ++i) {
    scanf("%d", &a);
    vt[a].push_back(i);
  }
}
void xuli() {
  int i, j, d;
  bool kt;
  nkq = 0;
  for (i = 1; i <= 100000; ++i) {
    if (vt[i].size()) {
      if (vt[i].size() == 1) {
        nkq++;
        kq[nkq][0] = i;
        kq[nkq][1] = 0;
      } else {
        kt = 1;
        d = vt[i][1] - vt[i][0];
        for (j = 2; j < vt[i].size(); ++j)
          if (vt[i][j] - vt[i][j - 1] != d) {
            kt = 0;
            break;
          }
        if (kt) {
          nkq++;
          kq[nkq][0] = i;
          kq[nkq][1] = d;
        }
      }
    }
  }
  printf("%d\n", nkq);
  for (i = 1; i <= nkq; ++i) printf("%d %d\n", kq[i][0], kq[i][1]);
}
int main() {
  nhap();
  xuli();
}
