#include <bits/stdc++.h>
using namespace std;
bool debug = false;
int main() {
  int n;
  cin >> n;
  int correctos = n;
  int a[100001][3];
  int aux;
  for (int i = 0; i < 100001; i++) a[i][0] = a[i][1] = a[i][2] = 0;
  if (debug) cout << "llenado" << endl;
  for (int i = 0; i < n; i++) {
    cin >> aux;
    if (debug) cout << "recibimos el numero" << aux << endl;
    if (a[aux][0] == -1) continue;
    if (debug) cout << "no estaba marcado" << endl;
    a[aux][0]++;
    if (a[aux][0] == 1) {
      a[aux][1] = 0;
      a[aux][2] = i;
    } else {
      if (a[aux][0] == 2) {
        a[aux][1] = i - a[aux][2];
        a[aux][2] = i;
      }
      if (a[aux][0] > 2 && i - a[aux][2] != a[aux][1]) {
        a[aux][0] = -1;
      } else
        a[aux][2] = i;
    }
  }
  int cont = 0;
  for (int i = 1; i < 100001; i++) {
    if (a[i][0] > 0) {
      cont++;
    }
  }
  cout << cont << endl;
  for (int i = 1; i < 100001; i++) {
    if (a[i][0] > 0) {
      cout << i << " " << a[i][1] << endl;
    }
  }
  return 0;
}
