#include <bits/stdc++.h>
using namespace std;
long long logPow(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans *= a;
    }
    a *= a;
    b = b >> 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, tmp;
  cin >> n;
  vector<pair<int, int> > vt;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    vt.push_back(make_pair(tmp, i));
  }
  sort(vt.begin(), vt.end());
  vector<pair<int, int> > ans;
  unordered_map<int, int> hm;
  int df = 0, prev = vt[0].first;
  hm[prev]++;
  for (int i = 1; i < n; i++) {
    if (hm[vt[i].first] == -1) {
      continue;
    }
    if (vt[i].first == vt[i - 1].first) {
      if (hm[prev] == 1) {
        df = vt[i].second - vt[i - 1].second;
        hm[prev]++;
      } else {
        if (df != vt[i].second - vt[i - 1].second) {
          hm[prev] = -1;
        }
      }
    } else {
      if (hm[prev] != -1) {
        ans.push_back(make_pair(prev, df));
      }
      df = 0;
      prev = vt[i].first;
      hm[prev]++;
    }
  }
  if (hm[prev] != -1) {
    ans.push_back(make_pair(prev, df));
  }
  cout << ans.size() << "\n";
  for (auto it : ans) {
    cout << it.first << " " << it.second << "\n";
  }
  return 0;
}
