#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tmp, period;
  cin >> n;
  vector<vector<int>> v(100001);
  vector<pair<int, int>> ans;
  for (int i = 0; i < n; ++i) {
    cin >> tmp;
    v[tmp].push_back(i);
  }
  for (int i = 0; i < 100001; ++i) {
    if (v[i].size() == 1) {
      ans.push_back({i, 0});
    }
    if (v[i].size() > 1) {
      period = v[i][1] - v[i][0];
      int q = 0;
      while (q < v[i].size() - 1 && v[i][q] + period == v[i][q + 1]) {
        q++;
      }
      if (q == v[i].size() - 1) {
        ans.push_back({i, period});
      }
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
}
