#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
int main() {
  int n;
  cin >> n;
  int ans = 0;
  int val;
  for (int i = 0; i < n; i++) {
    cin >> val;
    v[val - 1].push_back(i);
  }
  stringstream ss;
  for (int i = 0; i < 100005; i++) {
    if (!v[i].size()) continue;
    if (v[i].size() == 1) {
      ss << i + 1 << " " << 0 << endl;
      ans++;
      continue;
    }
    int flag = true;
    int diff = v[i][1] - v[i][0];
    for (int j = 2; j < v[i].size(); j++) {
      if (diff != v[i][j] - v[i][j - 1]) {
        flag = false;
      }
    }
    if (flag) {
      ss << i + 1 << " " << diff << endl;
      ans++;
    }
  }
  string s;
  cout << ans << endl;
  while (ss.good()) {
    getline(ss, s);
    cout << s << endl;
  }
}
