#include <bits/stdc++.h>
using namespace std;
const int MAX = 100000 + 10;
int pos[MAX], s[MAX];
int main() {
  int n, a;
  while (cin >> n) {
    memset(pos, 0, sizeof pos);
    memset(s, -1, sizeof s);
    for (int i = 1; i <= n; ++i) {
      cin >> a;
      if (s[a] == -1)
        s[a] = 0;
      else if (s[a] == 0)
        s[a] = i - pos[a];
      else if (s[a] > 0 && i - pos[a] != s[a])
        s[a] = -2;
      pos[a] = i;
    }
    int sum = 0;
    for (int i = 1; i < MAX; ++i)
      if (s[i] >= 0) ++sum;
    cout << sum << endl;
    for (int i = 1; i < MAX; ++i) {
      if (s[i] >= 0) cout << i << ' ' << s[i] << endl;
    }
  }
  return 0;
}
