#include <bits/stdc++.h>
using namespace std;
bool visited[100005];
vector<long long> arr[100005];
int main() {
  std::ios::sync_with_stdio(false);
  long long n, x;
  cin >> n;
  vector<pair<long long, long long> > ans;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    arr[x].push_back(i);
  }
  for (long long i = 0; i < 100005; i++) {
    if (arr[i].size() == 1) {
      ans.push_back(make_pair(i, 0));
    } else if (arr[i].size() >= 2) {
      bool good = 1;
      long long dif = arr[i][1] - arr[i][0];
      for (long long j = 1; j < arr[i].size(); j++) {
        if (arr[i][j] != arr[i][j - 1] + dif) good = 0;
      }
      if (good) {
        ans.push_back(make_pair(i, dif));
      }
    }
  }
  cout << ans.size() << endl;
  for (long long i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
