#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, vector<int>> mp;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    mp[a].push_back(i);
  }
  vector<pair<int, int>> ans;
  int cnt = 0;
  for (auto ele : mp) {
    int a = ele.first;
    vector<int> pos = ele.second;
    if (pos.size() == 1) {
      ans.push_back({a, 0});
    } else {
      int diff = pos[1] - pos[0];
      bool can = true;
      for (int i = 2; i <= pos.size() - 1; i++) {
        if (pos[i] - pos[i - 1] != diff) {
          can = false;
          break;
        }
      }
      if (can) {
        ans.push_back({a, diff});
      }
    }
  }
  cout << ans.size() << endl;
  for (auto& ele : ans) {
    cout << ele.first << " " << ele.second << endl;
  }
  return 0;
}
