#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  map<int, vector<int>> mp;
  int n;
  cin >> n;
  int arr[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    mp[arr[i]].push_back(i);
  }
  map<int, int> res;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    vector<int> vec = mp[it->first];
    if (vec.size() == 1) {
      res[it->first] = 0;
    } else {
      int ok = 0;
      int dif = vec[1] - vec[0];
      for (int i = 1; i < vec.size() - 1; i++) {
        if (vec[i + 1] - vec[i] != dif) {
          ok = 1;
          break;
        }
      }
      if (!ok) res[it->first] = dif;
    }
  }
  cout << res.size() << '\n';
  for (auto it = res.begin(); it != res.end(); it++) {
    cout << it->first << ' ' << it->second << '\n';
  }
}
