#include <bits/stdc++.h>
using namespace std;
vector<int> a[100007];
int main() {
  int n, first;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &first);
    a[first].push_back(i);
  }
  vector<pair<int, int> > ans;
  for (int i = 1; i <= 100007 - 7; i++) {
    if (a[i].size() == 0) continue;
    if (a[i].size() == 1)
      ans.push_back(make_pair(i, 0));
    else if (a[i].size() == 2)
      ans.push_back(make_pair(i, a[i][1] - a[i][0]));
    else {
      int d = a[i][1] - a[i][0], b = 1;
      for (int j = 2; j <= (int)a[i].size() - 1; j++)
        if (a[i][j] - a[i][j - 1] != d) {
          b = 0;
          break;
        }
      if (b) ans.push_back(make_pair(i, a[i][1] - a[i][0]));
    }
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (int i = 0; i <= (int)ans.size() - 1; i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
