#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  vector<pair<long long int, long long int> > V;
  vector<pair<long long int, long long int> > A;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    V.push_back(make_pair(a[i], i));
  }
  sort(V.begin(), V.end());
  long long int c = 0;
  long long int t = 1;
  long long int ans = 0, s = 1;
  long long int p;
  bool b = false;
  for (long long int i = 0; i < n; i++) {
    if (t == 1) {
      p = V[i + 1].second - V[i].second;
      t = 0;
    }
    if (V[i].first == V[i + 1].first) {
      c++;
      if (p == V[i + 1].second - V[i].second && s > 0) {
        b = true;
      } else {
        b = false;
        s = 0;
      }
    } else {
      if (c == 0) {
        p = 0;
      }
      if (b == true || c == 0) {
        ans++;
        A.push_back(make_pair(V[i].first, p));
      }
      b = false;
      c = 0;
      t = 1;
      s = 1;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < A.size(); i++) {
    cout << A[i].first << " " << A[i].second << endl;
  }
  return 0;
}
