#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1 + 100000;
const int INF = 10 + 1000000000;
int n;
int d[MAXN], last[MAXN];
int main() {
  int x, lo = MAXN, hi = 0;
  ({
    int neg = 0;
    n = 0;
    char ch;
    for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
      if (ch == '-') neg = 1 - neg;
    n = ch - 48;
    for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
      n = (n << 3) + (n << 1) + ch - 48;
    if (neg) n = -n;
  });
  memset(last, 0xff, sizeof last);
  memset(d, 0xff, sizeof d);
  for (int i = (0), _b = (n); i < _b; ++i) {
    ({
      int neg = 0;
      x = 0;
      char ch;
      for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
        if (ch == '-') neg = 1 - neg;
      x = ch - 48;
      for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
        x = (x << 3) + (x << 1) + ch - 48;
      if (neg) x = -x;
    });
    lo = min(lo, x);
    hi = max(hi, x);
    if (last[x] == -1)
      d[x] = 0;
    else {
      if (d[x] == 0)
        d[x] = i - last[x];
      else if (d[x] != -1) {
        if (i - last[x] != d[x]) {
          d[x] = -1;
        }
      }
    }
    last[x] = i;
  }
  int c = 0;
  for (int i = (lo), _b = (hi); i <= _b; ++i)
    if (last[i] != -1 && d[i] != -1) c++;
  printf("%d\n", c);
  for (int i = (lo), _b = (hi); i <= _b; ++i)
    if (last[i] != -1 && d[i] != -1) printf("%d %d\n", i, d[i]);
  return 0;
}
