#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, pair<int, int> > mp;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    if (mp.find(a[i]) == mp.end()) {
      mp[a[i]] = make_pair(0, i);
    } else {
      if (mp[a[i]].first == 0) {
        mp[a[i]].first = i - mp[a[i]].second;
        mp[a[i]].second = i;
      } else {
        if ((i - mp[a[i]].second) != mp[a[i]].first) {
          mp[a[i]].first = -1;
        } else {
          mp[a[i]].second = i;
        }
      }
    }
  }
  int count = 0;
  map<int, pair<int, int> >::iterator it;
  for (it = mp.begin(); it != mp.end(); it++) {
    if ((it->second).first != -1) {
      count++;
    }
  }
  cout << count << endl;
  for (it = mp.begin(); it != mp.end(); it++) {
    if ((it->second).first != -1) {
      cout << it->first << " " << (it->second).first << endl;
    }
  }
}
