#include <bits/stdc++.h>
using namespace std;
long long int d[100100], cou[100100], sum[100100];
long long int dd[100100];
int main() {
  long long int n;
  cin >> n;
  long long int x;
  for (long long int i = 1; i <= n; ++i) {
    cin >> x;
    cou[x]++;
    if (cou[x] == 1)
      d[x] = i;
    else if (cou[x] == 2)
      dd[x] = i - d[x];
    sum[x] += i;
  }
  long long int ans[100100][2];
  long long int k = 0;
  for (long long int i = 1; i <= 100000; ++i) {
    if (cou[i] > 0) {
      if (cou[i] == 1)
        ans[k][0] = i, ans[k++][1] = 0;
      else {
        long long int s = cou[i];
        s *= (d[i] * 2 + (s - 1) * dd[i]);
        s /= 2;
        if (s == sum[i]) ans[k][0] = i, ans[k++][1] = dd[i];
      }
    }
  }
  cout << k << endl;
  for (int i = 0; i < k; ++i) cout << ans[i][0] << " " << ans[i][1] << endl;
  return 0;
}
