#include <bits/stdc++.h>
const double Pi = acos(-1);
const double PCSN = 1e-10;
const int SIZE = 1e5 + 10;
const int SIZE2 = 30;
const int INF = 200000000;
using namespace std;
vector<int> data[SIZE];
set<int> dset;
set<int>::iterator it;
struct xxx {
  int x, y;
  xxx() {}
  xxx(int _x, int _y) {
    x = _x;
    y = _y;
  }
};
vector<xxx> out;
int main() {
  int n, a;
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &a);
      data[a].push_back(i);
      dset.insert(a);
    }
    for (it = dset.begin(); it != dset.end(); it++) {
      int indx = *it;
      if ((int)data[indx].size() == 1)
        out.push_back(xxx(indx, 0));
      else if ((int)data[indx].size() == 2)
        out.push_back(xxx(indx, data[indx][1] - data[indx][0]));
      else if ((int)data[indx].size() > 2) {
        int diff = data[indx][1] - data[indx][0], flag = 1;
        for (int i = 1; i < (int)data[indx].size(); i++) {
          if (diff != data[indx][i] - data[indx][i - 1]) {
            flag = 0;
            break;
          }
        }
        if (flag) out.push_back(xxx(indx, diff));
      }
      data[indx].clear();
    }
    cout << (int)out.size() << endl;
    for (int i = 0; i < (int)out.size(); i++) {
      cout << out[i].x << " " << out[i].y << endl;
    }
    out.clear();
    dset.clear();
  }
  return 0;
}
