#include <bits/stdc++.h>
using namespace std;
void mego() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
bool isp(long long x) {
  for (long long i = 2; i * i <= x; i++)
    if (!(x % i)) return false;
  return true;
}
long long coun = 0;
int gcd(long long a, long long b) {
  if (b == 0) return a;
  coun += (a / b);
  return gcd(b, a % b);
}
int main() {
  mego();
  long long n, a, z = 0, b = 0, d = 0, c = 0;
  vector<long long> v, v1;
  long long t = 0;
  cin >> t;
  map<int, pair<int, int> > ma;
  for (int i = 1; i <= t; i++) {
    cin >> a;
    if (!ma[a].first) {
      ma[a].first = i;
    } else if (!ma[a].second)
      ma[a].second = i;
    else {
      if ((i - ma[a].second) != (ma[a].second - ma[a].first)) {
        ma[a].first = -1;
        ma[a].second = -1;
      } else {
        ma[a].first = ma[a].second;
        ma[a].second = i;
      }
    }
  }
  vector<pair<int, int> > vp;
  pair<int, int> rej = {-1, -1};
  for (auto it : ma) {
    if (it.second != rej) {
      vp.push_back(make_pair(it.first, it.second.second - it.second.first));
    }
  }
  cout << vp.size() << "\n";
  for (int i = 0; i < vp.size(); i++) {
    cout << vp[i].first << " " << (vp[i].second > 0 ? vp[i].second : 0) << "\n";
  }
  return 0;
}
