#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-3;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int lcm(int a, int b) {
  if (b > a) swap(a, b);
  return (a * b) / gcd(a, b);
}
int power(int b, int p) {
  if (p == 0) return 1;
  int sq = power(b, p / 2);
  sq = sq * sq;
  if (p % 2 == 1) sq *= b;
  return sq;
}
const int MAX = 2e5;
const int oo = 1e7;
int xDir[] = {0, 0, 1, -1};
int yDir[] = {1, -1, 0, 0};
int dcomp(double a, double b) {
  if (fabs(a - b) <= EPS) return 0;
  return ((a > b) ? 1 : -1);
}
int arr[100001];
int elements[100001];
int dist[100001];
bool vis[100001];
bool vis1[100001];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, x;
  cin >> n;
  memset(dist, -1, sizeof dist);
  memset(arr, -1, sizeof arr);
  for (int i = 0; i < n; i++) {
    cin >> x;
    elements[i] = x;
    if (vis[x]) continue;
    if (arr[x] == -1) {
      arr[x] = i;
    } else {
      int temp = i - arr[x];
      if (dist[x] == -1) {
        dist[x] = temp;
        arr[x] = i;
      } else {
        if (temp != dist[x]) {
          vis[x] = 1;
        } else {
          arr[x] = i;
        }
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (!vis[elements[i]] && !vis1[elements[i]]) {
      cnt++;
      vis1[elements[i]] = 1;
    }
  }
  sort(elements, elements + n);
  cout << cnt << endl;
  for (int i = 0; i < n; i++) {
    if (vis[elements[i]]) continue;
    if (dist[elements[i]] != -1) {
      cout << elements[i] << " " << dist[elements[i]] << endl;
      vis[elements[i]] = 1;
    } else {
      cout << elements[i] << " " << 0 << endl;
      vis[elements[i]] = 1;
    }
  }
  return 0;
}
