#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> a[100007];
long long c[100007];
vector<long long> r[100007];
int main() {
  long long n;
  cin >> n;
  long long v, cnt = 0;
  for (long long i = 0; i < n; i++) {
    cin >> v;
    a[i].first = v;
    a[i].second = i;
    c[v]++;
  }
  sort(a, a + n);
  for (long long i = 0; i < n; i++) {
    v = a[i].first;
    long long f = 0;
    if (c[v] > 1) {
      long long d = a[i + 1].second - a[i].second;
      for (long long j = 2; j < c[v]; j++) {
        i++;
        long long dp = a[i + 1].second - a[i].second;
        if (dp != d) f = 1;
      }
      i++;
      if (f == 0) {
        r[cnt].push_back(v);
        r[cnt].push_back(d);
        cnt++;
      }
    } else {
      r[cnt].push_back(v);
      r[cnt].push_back(0);
      cnt++;
    }
  }
  cout << cnt << endl;
  if (cnt > 0) {
    for (long long i = 0; i < cnt; i++) {
      cout << r[i][0] << " " << r[i][1] << endl;
    }
  }
  return 0;
}
