#include <bits/stdc++.h>
using namespace std;
class answer {
 public:
  int x = 0;
  int y = 0;
};
bool sorter(answer a, answer b) {
  if (a.x == b.x) return a.y < b.y;
  return a.x < b.x;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  answer arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i].x;
    arr[i].y = i;
  }
  if (n == 1) {
    cout << 1 << endl;
    cout << arr[0].x << " " << 0 << endl;
  } else {
    sort(arr, arr + n, sorter);
    int d = 0;
    int total = 0;
    queue<answer> ans;
    bool ap = true;
    for (int i = 0; i < n; i++) {
      if (i == n - 1 && ap) {
        answer k;
        k.x = arr[i].x;
        k.y = d;
        ans.push(k);
        total++;
        d = 0;
      } else {
        if (arr[i].x == arr[i + 1].x) {
          if (d == 0) {
            d = arr[i + 1].y - arr[i].y;
          } else {
            if (d != (arr[i + 1].y - arr[i].y)) {
              ap = false;
            }
          }
        } else {
          if (ap) {
            answer k;
            k.x = arr[i].x;
            k.y = d;
            ans.push(k);
            total++;
            d = 0;
          } else {
            d = 0;
            ap = true;
          }
        }
      }
    }
    cout << total << endl;
    while (ans.empty() != 1) {
      answer k = ans.front();
      ans.pop();
      cout << k.x << " " << k.y << endl;
    }
  }
  return 0;
}
