#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long xor1_n(long long n) {
  switch (n % 4) {
    case 0:
      return n;
    case 1:
      return 1;
    case 2:
      return n + 1;
  }
  return 0;
}
int ncr(int n, int r) {
  int res = 1;
  if (r > n - r) r = n - r;
  for (int i = 0; i < r; i++) {
    res *= n - i;
    res /= i + 1;
  }
  return res;
}
clock_t time_p = clock();
void rtime() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
long long power(long long a, long long b, long long m = mod) {
  long long ans = 1;
  a = a % m;
  while (b > 0) {
    if (b & 1) ans = (1ll * a * ans) % m;
    b >>= 1;
    a = (1ll * a * a) % m;
  }
  return ans;
}
int rr[] = {
    0, 1, 1, 1, 0, -1, -1, -1,
};
int cc[] = {1, 1, 0, -1, -1, -1, 0, 1};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    int a[n], x = 0;
    vector<vector<int>> ad(100001);
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (mp[a[i]] == 0) mp[a[i]]++;
      ad[a[i]].push_back(i);
    }
    sort(a, a + n);
    vector<pair<int, int>> ans;
    for (int i = 0; i < n; i++) {
      if (mp[a[i]]) {
        mp[a[i]]--;
        if (ad[a[i]].size() == 1)
          ans.push_back({a[i], 0});
        else {
          int x = ad[a[i]][1] - ad[a[i]][0], ok = 1;
          for (int j = 1; j < ad[a[i]].size(); j++) {
            if (ad[a[i]][j] - ad[a[i]][j - 1] != x) {
              ok = 0;
              break;
            }
          }
          if (ok) ans.push_back({a[i], x});
        }
      }
    }
    cout << ans.size() << "\n";
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i].first << " " << ans[i].second << "\n";
    }
  }
  rtime();
  return 0;
}
