#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int a[n];
  map<int, vector<int>> mp;
  for (int i = 0; i < n; i++) cin >> a[i], mp[a[i]].push_back(i);
  vector<pair<int, int>> ans;
  for (auto i : mp) {
    if (i.second.size() == 1)
      ans.push_back({i.first, 0});
    else if (i.second.size() == 2)
      ans.push_back({i.first, i.second[1] - i.second[0]});
    else {
      int dis = i.second[1] - i.second[0];
      int f = 1;
      for (int j = 2; j < i.second.size(); j++)
        if ((i.second[j] - i.second[j - 1]) != dis) f = 0;
      if (f) ans.push_back({i.first, dis});
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
}
int main() { solve(); }
