#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N];
vector<pair<int, int>> cont;
vector<pair<int, int>> sol;
int main() {
  set<int> st;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cont.push_back(make_pair(a[i], i));
  }
  sort(cont.begin(), cont.end());
  for (int i = 0; i < cont.size(); i++) {
    if (cont[i].first == cont[i + 1].first) {
      st.insert(cont[i + 1].second - cont[i].second);
    } else {
      if (st.size() == 1) {
        sol.push_back(
            make_pair(cont[i].first, cont[i].second - cont[i - 1].second));
      }
      if (st.size() == 0) {
        sol.push_back(make_pair(cont[i].first, 0));
      }
      st.clear();
    }
  }
  cout << sol.size() << endl;
  for (int i = 0; i < sol.size(); i++) {
    cout << sol[i].first << " " << sol[i].second << endl;
  }
}
