#include <bits/stdc++.h>
using namespace std;
bool arr[1000 + 1][1000 + 1];
int main() {
  map<long long, vector<long long>> mp;
  long long r;
  long long n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> r;
    mp[r].push_back(i);
  }
  vector<pair<long long, long long>> ans;
  for (auto x : mp) {
    vector<long long> v = x.second;
    if (v.size() == 1) {
      ans.push_back(make_pair(x.first, 0));
    } else {
      vector<long long> t;
      for (long long i = 1; i < v.size(); i++) t.push_back(v[i] - v[i - 1]);
      bool res = true;
      for (long long i = 1; i < t.size(); i++) {
        if (t[i] != t[i - 1]) res = false;
      }
      if (res) {
        ans.push_back(make_pair(x.first, t[0]));
      }
    }
  }
  cout << ans.size() << "\n";
  for (auto x : ans) cout << x.first << " " << x.second << "\n";
}
