#include <bits/stdc++.h>
using namespace std;
void IOS() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void solve() {
  long long n;
  cin >> n;
  map<long long, pair<long long, long long>> mp;
  for (long long i = 0; i < n; i++) {
    long long num;
    cin >> num;
    if (mp.find(num) != mp.end()) {
      pair<long long, long long> p = mp[num];
      long long currind = p.first;
      long long diff = p.second;
      if (diff == -1 && currind == -1)
        continue;
      else if (diff == 0)
        mp[num] = {i, i - currind};
      else {
        if (diff == i - currind)
          mp[num] = {i, i - currind};
        else
          mp[num] = {-1, -1};
      }
    } else
      mp[num] = make_pair(i, 0);
  }
  long long ct = 0;
  for (map<long long, pair<long long, long long>>::iterator it = mp.begin();
       it != mp.end(); it++) {
    long long num = it->first;
    pair<long long, long long> p = it->second;
    if (p.first == -1 && p.second == -1)
      continue;
    else
      ct++;
  }
  cout << ct << endl;
  for (map<long long, pair<long long, long long>>::iterator it = mp.begin();
       it != mp.end(); it++) {
    long long num = it->first;
    pair<long long, long long> p = it->second;
    if (p.first == -1 && p.second == -1)
      continue;
    else
      cout << num << " " << p.second << endl;
  }
  cout << endl;
}
int32_t main() {
  IOS();
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
