#include <bits/stdc++.h>
using namespace std;
long long n, m, b, c;
vector<int> a[100001];
vector<pair<int, int> > ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b;
    a[b].push_back(i);
  }
  for (int i = 0; i < 100001; i++) {
    if (!a[i].empty()) {
      if (a[i].size() == 1)
        ans.push_back(make_pair(i, 0));
      else {
        bool check = true;
        c = a[i][1] - a[i][0];
        for (int j = 2; j < a[i].size(); j++) {
          if (a[i][j] - a[i][j - 1] != c) check = false;
        }
        if (check) ans.push_back(make_pair(i, c));
      }
    }
  }
  cout << ans.size();
  for (int i = 0; i < ans.size(); i++) {
    cout << endl << ans[i].first << " " << ans[i].second;
  }
  return 0;
}
