#include <bits/stdc++.h>
using namespace std;
const long double EPS = (1e-10);
const long long MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, x, sz = 100005;
  cin >> n;
  set<int> s;
  vector<vector<int>> v(sz);
  for (int i = 0; i < n; i++) {
    cin >> x;
    s.insert(x);
    v[x].push_back(i);
  }
  vector<pair<int, int>> ans;
  for (auto i = s.begin(); i != s.end(); i++) {
    bool once = 1, valid = 1;
    int d = 0;
    for (int j = 0; j < v[*i].size() - 1; j++) {
      if (v[*i][j + 1] - v[*i][j] != d) {
        if (once)
          once = 0, d = v[*i][j + 1] - v[*i][j];
        else {
          valid = 0;
          break;
        }
      }
    }
    if (valid) {
      ans.push_back({*i, d});
    }
  }
  cout << ans.size() << '\n';
  for (auto &i : ans) cout << i.first << ' ' << i.second << '\n';
}
