#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, num;
  cin >> n;
  map<int, int> m;
  unordered_map<int, int> um;
  for (int i = 1; i <= n; i++) {
    cin >> num;
    auto it = m.find(num);
    if (it == m.end())
      m.insert(make_pair(num, i));
    else {
      if (it->second == -1) continue;
      int temp = m[num];
      m[num] = i;
      if (um.find(num) == um.end())
        um[num] = (i - temp);
      else {
        if (temp + um[num] != i) m[num] = -1;
      }
    }
  }
  set<pair<int, int> > s;
  for (auto it : m) {
    if (it.second != -1) s.insert(make_pair(it.first, um[it.first]));
  }
  cout << s.size() << "\n";
  for (auto it : s) cout << it.first << " " << it.second << "\n";
}
