#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
vector<ll> prime_factors(ll num) {
  vector<ll> ans;
  while (num % 2) {
    ans.push_back(2);
    num /= 2;
  }
  for (int i = 3; i * i <= num; i += 2) {
    while (num % i == 0) {
      ans.push_back(i);
      num /= i;
    }
  }
  if (num > 2) ans.push_back(num);
  return ans;
}
void tests() {
  int n;
  cin >> n;
  map<int, vector<int>> data;
  vector<pair<int, int>> ans;
  ans.reserve(n);
  for (int i = 1; i < n + 1; i++) {
    int x;
    cin >> x;
    data[x].push_back(i);
  }
  for (auto &i : data) {
    int len = i.second.size();
    if (len == 1)
      ans.push_back(make_pair(i.first, 0));
    else if (len == 2)
      ans.push_back(make_pair(i.first, i.second[1] - i.second[0]));
    else {
      int cd = i.second[1] - i.second[0];
      for (int pos = 2; pos < len; ++pos) {
        if (i.second[pos] - i.second[pos - 1] != cd) goto end;
      }
      ans.push_back(make_pair(i.first, cd));
    }
  end:;
  }
  cout << ans.size() << char(10);
  for (auto &i : ans) cout << i.first << char(32) << i.second << char(10);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    tests();
  }
  return 0;
}
