#include <bits/stdc++.h>
using namespace std;
const long long int mxn = 1e5 + 5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    long long int i, j, k, n, m;
    cin >> n;
    map<long long int, long long int> mp, diff;
    for (i = 0; i < n; i++) {
      cin >> k;
      if (mp.find(k) == mp.end())
        mp[k] = i, diff[k] = 0;
      else if (diff[k] == 0 || i - mp[k] == diff[k]) {
        if (diff[k] == 0) diff[k] = i - mp[k];
        mp[k] = i;
      } else
        diff[k] = -1;
    }
    set<pair<long long int, long long int> > ans;
    for (auto i : diff)
      if (i.second != -1) ans.insert(make_pair(i.first, i.second));
    cout << ans.size() << "\n";
    for (auto i : ans) cout << i.first << " " << i.second << "\n";
  }
  return 0;
}
