#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<int> v1[200000];
  vector<pair<int, int> > v2;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int q;
    cin >> q;
    v1[q].push_back(i);
  }
  int k;
  for (int i = 1; i <= 100000; i++) {
    if (v1[i].size() == 0) continue;
    k = 0;
    for (int j = 1; j < v1[i].size(); j++)
      if (v1[i][1] - v1[i][0] != v1[i][j] - v1[i][j - 1]) k = 1;
    if (k == 0) {
      v1[i].push_back(v1[i][0]);
      v2.push_back(make_pair(i, v1[i][1] - v1[i][0]));
    }
  }
  cout << v2.size() << endl;
  for (int i = 0; i < v2.size(); i++) {
    cout << v2[i].first << " " << v2[i].second << endl;
  }
  return 0;
}
