#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  vector<pair<int, int>> v;
  set<int> s;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    v.push_back(make_pair(a[i], i));
    s.insert(a[i]);
  }
  int m = s.size();
  sort(v.begin(), v.end());
  vector<int> r;
  for (auto i : s) {
    r.push_back(i);
  }
  if (n == 1) {
    cout << 1 << endl;
    cout << a[0] << " " << 0;
  } else {
    int x = 0;
    vector<vector<int>> p(m);
    for (int i = 0; i < n; i++) {
      if (i == 0 || v[i].first == v[i - 1].first) {
        p[x].push_back(v[i].second);
      } else {
        x++;
        p[x].push_back(v[i].second);
      }
    }
    vector<pair<int, int>> o;
    for (int i = 0; i < m; i++) {
      if (p[i].size() == 1) {
        o.push_back(make_pair(r[i], 0));
      } else {
        bool f = true;
        int x = p[i][1] - p[i][0];
        for (int j = 2; j < p[i].size(); j++) {
          if ((p[i][j - 1] + x) != p[i][j]) {
            f = false;
            break;
          }
        }
        if (f == true) {
          o.push_back(make_pair(r[i], x));
        }
      }
    }
    cout << o.size() << endl;
    for (int i = 0; i < o.size(); i++) {
      cout << o[i].first << " " << o[i].second << endl;
    }
  }
}
