#include <bits/stdc++.h>
using namespace std;
int v[100001];
int u[100001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  for (int i = 0; i < 1e5 + 1; i++) v[i] = 0, u[i] = 0;
  int n, m;
  cin >> n;
  pair<int, int> arr[n + 1];
  for (int i = 1; i < n + 1; i++) cin >> m, arr[i] = make_pair(m, i);
  arr[0] = make_pair(-1, 0);
  sort(arr, arr + n + 1);
  int count = 0;
  for (int i = 1; i < n + 1; i++) {
    if (v[arr[i].first] != 0) {
      if (v[arr[i].first] == -2 ||
          abs(arr[i].second - u[arr[i].first]) == v[arr[i].first]) {
        v[arr[i].first] = abs(arr[i].second - u[arr[i].first]);
        u[arr[i].first] = arr[i].second;
      } else {
        v[arr[i].first] = -1;
      }
    } else {
      v[arr[i].first] = -2;
      u[arr[i].first] = arr[i].second;
    }
  }
  for (int i = 0; i < 1e5 + 1; i++) {
    if (v[i] > 0) {
      count++;
    } else if (v[i] == -2) {
      count++;
    }
  }
  if (count == 0) {
    cout << 0 << endl;
    return 0;
  }
  cout << count << endl;
  for (int i = 0; i < 1e5 + 1; i++) {
    if (v[i] > 0) {
      cout << i << " " << v[i] << endl;
    } else if (v[i] == -2) {
      cout << i << " " << 0 << endl;
    }
  }
  return 0;
}
