#include <bits/stdc++.h>
using namespace std;
void code() {
  long long n;
  cin >> n;
  map<long long, vector<long long>> mp;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    mp[a].push_back(i + 1);
  }
  vector<pair<long long, long long>> ans;
  for (auto i : mp) {
    bool isValid = true;
    long long l = ((long long)i.second.size());
    if (l == 1)
      ans.push_back({i.first, 0});
    else {
      long long diff = i.second[1] - i.second[0];
      for (long long j = 0; j < l - 1; j++) {
        long long tmp = i.second[j + 1] - i.second[j];
        if (tmp != diff) isValid = false;
      }
      if (isValid) ans.push_back({i.first, diff});
    }
  }
  long long l = ((long long)ans.size());
  cout << l << endl;
  for (long long i = 0; i < l; i++)
    cout << ans[i].first << " " << ans[i].second << endl;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  for (long long i = 0; i < t; i++) {
    code();
  }
  return 0;
}
