#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int N;
  cin >> N;
  vector<long long int> v(N + 1);
  map<long long int, vector<long long int>> m;
  vector<pair<long long int, long long int>> ans;
  for (long long int i = 1; i <= N; i++) {
    cin >> v[i];
    m[v[i]].push_back(i);
  }
  long long int cnt = 0;
  for (auto i = m.begin(); i != m.end(); i++) {
    if ((i->second).size() == 1) {
      cnt++;
      ans.push_back(pair<long long int, long long int>(i->first, 0));
    } else if ((i->second).size() == 2) {
      cnt++;
      ans.push_back(pair<long long int, long long int>(
          i->first, (i->second)[1] - (i->second)[0]));
    } else {
      bool ck = 1;
      long long int D = (i->second)[1] - (i->second)[0];
      for (long long int j = 1; j < (i->second).size() - 1; j++) {
        if ((i->second)[j + 1] != (i->second)[j] + D) {
          ck = 0;
          break;
        }
      }
      if (ck) {
        cnt++;
        ans.push_back(pair<long long int, long long int>(
            i->first, (i->second)[1] - (i->second)[0]));
      }
    }
  }
  cout << cnt << endl;
  for (long long int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
  return (0);
}
