#include <bits/stdc++.h>
using namespace std;
const int NMax = 100004;
const int INF = (int)(1e9 + 1);
const int cntTree = 2 * 262145;
const double eps = 1e-9;
const double PI = 3.141592653589793238462;
const int MD = (int)1e9 + 7;
vector<int> p[NMax];
int n, a, m = 0;
int ans1[NMax], ans2[NMax];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%i", &a);
    p[a].push_back(i);
  }
  for (int i = 1; i <= 100000; i++) {
    if ((int)(p[i]).size() == 0) continue;
    if ((int)(p[i]).size() == 1) {
      ans1[++m] = i;
      ans2[m] = 0;
      continue;
    }
    int tmp = p[i][1] - p[i][0];
    bool flag = false;
    for (int j = 1; j < (int)(p[i]).size(); j++)
      if (tmp != p[i][j] - p[i][j - 1]) flag = true;
    if (!flag) {
      ans1[++m] = i;
      ans2[m] = tmp;
    }
  }
  cout << m << endl;
  for (int i = 1; i <= m; i++) printf("%i %i\n", ans1[i], ans2[i]);
  return 0;
}
