#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> v(n);
  map<int, pair<int, int> > mp;
  for (int i = 0; i <= n - 1; ++i) {
    cin >> v[i];
    if (mp.find(v[i]) == mp.end())
      mp[v[i]].first = i, mp[v[i]].second = 0;
    else {
      if (mp[v[i]].second == -1) continue;
      if (mp[v[i]].second == 0)
        mp[v[i]].second = i - mp[v[i]].first, mp[v[i]].first = i;
      else {
        if (i - mp[v[i]].first == mp[v[i]].second)
          mp[v[i]].first = i;
        else
          mp[v[i]].second = -1;
      }
    }
  }
  int cnt = 0;
  for (auto x : mp)
    if (x.second.second >= 0) cnt++;
  cout << cnt << endl;
  for (auto x : mp) {
    if (x.second.second >= 0) cout << x.first << " " << x.second.second << endl;
  }
  return 0;
}
