#include <bits/stdc++.h>
using namespace std;
int check(vector<int> v[], int n) {
  int x = v[n][1] - v[n][0];
  for (int j = 1; j < (v[n].size() - 1); j++) {
    if (v[n][j + 1] - v[n][j] != x) {
      return -1;
    }
  }
  return x;
}
int main() {
  int n;
  cin >> n;
  int a[n];
  vector<int> v[100001];
  int mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int x = a[i];
    mx = max(mx, x);
    v[x].push_back(i);
  }
  map<int, int> mp;
  for (int i = 1; i <= mx; i++) {
    if (v[i].size() >= 2) {
      int d = check(v, i);
      if (d != -1) {
        mp[i] = d;
      }
    } else if (v[i].size() == 1) {
      mp[i] = 0;
    } else
      continue;
  }
  cout << mp.size() << endl;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    cout << (*it).first << " " << (*it).second << endl;
  }
  return 0;
}
