#include <bits/stdc++.h>
using namespace std;
int n, m;
int solve1(vector<vector<int>> arr, int i, int j) {
  int res = 0;
  int a = 1, b = 1, c = 1, d = 1;
  while ((i + a) < n && (i - b) >= 0 && (j + c) < m && (j - d) >= 0) {
    if (arr[(i + a)][j] == arr[i - b][j] && arr[i][j + c] == arr[i][j - d]) {
      res += 1;
      a += 1;
      b += 1;
      c += 1;
      d += 1;
    } else {
      break;
    }
  }
  return res;
}
void x() {
  int n;
  cin >> n;
  vector<pair<int, int>> ans;
  map<int, vector<int>> arr;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    arr[a].emplace_back(i);
  }
  for (auto i : arr) {
    int size = i.second.size();
    if (size > 0) {
      if (size == 1) {
        pair<int, int> tt = {i.first, 0};
        ans.emplace_back(tt);
        continue;
      }
      bool flag = true;
      for (int j = 1; j < size - 1; j++) {
        if (i.second[j] - i.second[j - 1] != i.second[j + 1] - i.second[j]) {
          flag = false;
          break;
        }
      }
      if (flag) {
        int diff = i.second[1] - i.second[0];
        pair<int, int> tt = {i.first, diff};
        ans.emplace_back(tt);
      }
    }
  }
  cout << ans.size() << endl;
  for (auto i : ans) {
    cout << i.first << " " << i.second << endl;
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  x();
  return 0;
}
