#include <bits/stdc++.h>
using namespace std;
void cpSetup() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int32_t main() {
  cpSetup();
  long long t;
  cin >> t;
  vector<pair<long long, long long> > d(t);
  for (long long i = 0; i < t; i++) {
    cin >> d[i].first;
    d[i].second = i;
  }
  sort(d.begin(), d.end());
  vector<pair<long long, long long> > res;
  long long i = 0;
  while (i < t) {
    if (d[i].first == d[i + 1].first) {
      long long p = d[i + 1].second - d[i].second;
      bool isPossible = true;
      while (d[i].first == d[i + 1].first) {
        if (d[i + 1].second - d[i].second != p) {
          isPossible = false;
        }
        i++;
      }
      if (isPossible) {
        res.emplace_back(d[i].first, p);
      }
      i++;
    } else {
      res.emplace_back(d[i].first, 0);
      i++;
    }
  }
  cout << res.size() << endl;
  for (auto r : res) {
    cout << r.first << " " << r.second << endl;
  }
  return 0;
}
