#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 2 * 1e5 + 2;
long long gcd(long long, long long);
long long modPower(long long, long long, long long);
long long power(long long, long long);
long long modInverse(long long, long long);
int lp[N + 1];
vector<int> pr;
void sieve() {
  for (int i = 2; i <= N; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (int j = 0; j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] <= N; ++j)
      lp[i * pr[j]] = pr[j];
  }
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long modPower(long long x, long long y, long long m) {
  if (y == 0) return 1;
  long long p = modPower(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
long long power(long long x, long long y) {
  if (y == 0) return 1;
  long long p = power(x, y / 2);
  p = (p * p);
  return (y % 2 == 0) ? p : (x * p);
}
long long modInverse(long long a, long long m) {
  return ((modPower(a, m - 2, m) + mod) % mod);
}
void solve() {
  int n;
  cin >> n;
  int arr[n];
  map<int, vector<int>> m;
  for (int i = (0); i < (n); i++) {
    cin >> arr[i];
    m[arr[i]].push_back(i);
  }
  map<int, pair<int, int>> res;
  for (auto i : m) {
    int num = i.first;
    int sz = m[num].size();
    if (sz == 1) {
      res[num] = make_pair(num, 0);
      continue;
    }
    bool trig = true;
    int diff = m[num][1] - m[num][0];
    for (int j = (0); j < (m[num].size()); j++) {
      if (j + 1 < m[num].size() && m[num][j + 1] - m[num][j] != diff)
        trig = false;
      if (!trig) break;
    }
    if (trig) res[num] = make_pair(num, diff);
  }
  cout << res.size() << "\n";
  for (auto i : res) {
    cout << i.first << " " << i.second.second << "\n";
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  for (int i = (0); i < (t); i++) solve();
  return 0;
}
