#include <bits/stdc++.h>
using namespace std;
unordered_map<int, vector<int>> mp;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    mp[a].push_back(i);
  }
  vector<pair<int, int>> ans;
  for (auto i : mp) {
    if (i.second.size() == 1)
      ans.push_back({i.first, 0});
    else {
      int diff = i.second[1] - i.second[0];
      bool seq = true;
      for (int j = 0; j < i.second.size() - 1; j++) {
        if (i.second[j + 1] - i.second[j] != diff) {
          seq = false;
          break;
        }
      }
      if (seq) ans.push_back({i.first, diff});
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << "\n";
  for (auto i : ans) {
    cout << i.first << " " << i.second << "\n";
  }
  return 0;
}
