#include <bits/stdc++.h>
using namespace std;
int n, x, pos[200000], dif[200000];
int main() {
  while (cin >> n) {
    for (int ii = 0; ii < (200000); ii++) pos[ii] = -1;
    ;
    set<int> st;
    for (int i = 0; i < n; i++) {
      scanf("%d", &x);
      st.insert(x);
      if (pos[x] == -1)
        pos[x] = i, dif[x] = 0;
      else {
        if (dif[x] == 0)
          dif[x] = i - pos[x];
        else if (dif[x] != i - pos[x])
          dif[x] = -1;
        pos[x] = i;
      }
    }
    vector<pair<int, int> > vct;
    for (auto von : st) {
      if (dif[von] != -1) vct.push_back(make_pair(von, dif[von]));
    }
    cout << vct.size() << endl;
    for (auto von : vct) {
      cout << von.first << " " << von.second << endl;
    }
  }
  return 0;
}
