#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> v[100001];
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    v[p].push_back(i);
  }
  vector<pair<int, int> > v1;
  for (int i = 1; i < 100001; i++) {
    int len = v[i].size();
    if (len) {
      if (len == 1) {
        v1.push_back(make_pair(i, 0));
        continue;
      }
      int diff = v[i][1] - v[i][0];
      bool ok = 1;
      for (int j = 1; j < len - 1; j++)
        if (v[i][j + 1] - v[i][j] != diff) {
          ok = 0;
          break;
        }
      if (ok) v1.push_back(make_pair(i, diff));
    }
  }
  int len = v1.size();
  cout << len << '\n';
  for (int i = 0; i < len; i++)
    cout << v1[i].first << ' ' << v1[i].second << '\n';
  return 0;
}
