#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[n];
  int c[100001] = {0};
  int b[100001] = {0};
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (c[a[i]] == 0) c[a[i]] = i + 1;
    if (b[a[i]] == 0) {
      b[a[i]] = i + 1 - c[a[i]];
    } else if (b[a[i]] != i + 1 - c[a[i]])
      b[a[i]] = -1;
    if (b[a[i]] == -1) continue;
    c[a[i]] = i + 1;
  }
  int ans = 0;
  for (int i = 0; i < 100001; ++i)
    if (c[i] && b[i] >= 0) ans++;
  cout << ans << endl;
  for (int i = 0; i < 100001; ++i)
    if (c[i] && b[i] >= 0) cout << i << ' ' << b[i] << endl;
  return 0;
}
