#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-11;
void fast() { std::ios_base::sync_with_stdio(0); }
vector<vector<int>> seq(1e5 + 9);
int main() {
  int n, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    seq[x].push_back(i);
  }
  bool flag = true;
  vector<pair<int, int>> ans;
  for (int i = 0; i <= 1e5; i++) {
    flag = true;
    if (seq[i].size() == 0)
      continue;
    else if (seq[i].size() == 1)
      ans.push_back({i, 0});
    else if (seq[i].size() == 2)
      ans.push_back({i, seq[i][1] - seq[i][0]});
    else {
      for (int j = 2; j < seq[i].size() && flag; j++) {
        if (seq[i][j] - seq[i][j - 1] != seq[i][j - 1] - seq[i][j - 2])
          flag = false;
      }
      if (flag) {
        ans.push_back({i, seq[i][1] - seq[i][0]});
      }
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
