#include <bits/stdc++.h>
using namespace std;
int n, a[100011], a2[100011], k;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (a[x] == 0 and a2[x] == 0) {
      k++;
      a2[x] = i;
      continue;
    }
    if (a[x] == 0 and a2[x] > 0) {
      a[x] = i - a2[x];
      a2[x] = i;
      continue;
    }
    if (a[x] != -1) {
      if (a[x] == i - a2[x]) {
        a2[x] = i;
      } else {
        k--;
        a[x] = -1;
      }
    }
  }
  cout << k << endl;
  for (int i = 1; i <= 100010; ++i) {
    if (a[i] > -1 && a2[i] > 0) cout << i << " " << a[i] << endl;
  }
}
