#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  map<int, vector<int>> mp;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    mp[t].push_back(i);
  }
  vector<pair<int, int>> ans;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    if ((it->second).size() == 1) {
      ans.push_back({it->first, 0});
      continue;
    }
    bool flag = true;
    int d = it->second[1] - it->second[0];
    for (int i = 2; i < it->second.size(); i++) {
      if (it->second[i] - it->second[i - 1] != d) {
        flag = false;
        break;
      }
    }
    if (flag) {
      ans.push_back({it->first, d});
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
}
