#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  map<int, vector<int> > m;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    m[a[i]].push_back(i);
  }
  for (auto x : m) {
    if (x.second.size() == 1)
      v.push_back(make_pair(x.first, 0));
    else {
      int k = x.second[1] - x.second[0];
      int flag = 1;
      for (int j = 2; j < x.second.size(); j++) {
        if (x.second[j] - x.second[j - 1] != k) {
          flag = 0;
          break;
        }
      }
      if (flag) {
        v.push_back(make_pair(x.first, k));
      }
    }
  }
  if (v.size() == 0)
    cout << 0 << '\n';
  else {
    cout << v.size() << '\n';
    for (auto a : v) cout << a.first << " " << a.second << '\n';
  }
}
