#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i;
  cin >> n;
  vector<int> v[100005];
  int a[n];
  for (i = 0; i < n + 1; i++) cin >> a[i];
  int maxim = *max_element(a, a + n);
  for (i = 0; i < n; i++) {
    v[a[i]].push_back(i + 1);
  }
  int count = 0;
  for (i = 1; i <= maxim; i++) {
    int s = v[i].size();
    if (v[i].size() > 1) {
      int flag = 0, d1, d2;
      for (int j = 1; j < s - 1; j++) {
        d1 = v[i][j] - v[i][j - 1];
        d2 = v[i][j + 1] - v[i][j];
        if (d1 != d2) {
          flag = 1;
          break;
        }
      }
      if (flag == 0) {
        count++;
      }
    } else if (v[i].size() == 1)
      count++;
  }
  cout << count << endl;
  for (i = 1; i <= maxim; i++) {
    int s = v[i].size();
    if (v[i].size() > 1) {
      int flag = 0, d1, d2;
      for (int j = 1; j < s - 1; j++) {
        d1 = v[i][j] - v[i][j - 1];
        d2 = v[i][j + 1] - v[i][j];
        if (d1 != d2) {
          flag = 1;
          break;
        }
      }
      if (flag == 0) {
        cout << i << " " << v[i][1] - v[i][0] << endl;
      }
    } else if (v[i].size() == 1) {
      cout << i << " " << 0 << endl;
    }
  }
  return 0;
}
