#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, r = 0;
  pair<int, int> a[100 * 1000 + 2], s[100 * 1000];
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; ++i) {
    int d = a[i + 1].second - a[i].second, k = i;
    bool f = true;
    while (i < n && a[i + 1].first == a[i].first) {
      if (a[i + 1].second != a[i].second + d) f = false;
      ++i;
    }
    if (f) s[r++] = pair<int, int>(a[i].first, (i != k) * d);
  }
  cout << r << '\n';
  for (int i = 0; i < r; ++i) cout << s[i].first << ' ' << s[i].second << '\n';
  return 0;
}
