#include <bits/stdc++.h>
using namespace std;
void input() {}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  input();
  int n;
  cin >> n;
  map<int, int> ans;
  map<int, vector<int>> m;
  for (long long int i = 0; i < n; i++) {
    int num;
    cin >> num;
    m[num].push_back(i);
  }
  for (auto j : m) {
    if (j.second.size() == 1) {
      ans[j.first] = 0;
    } else {
      int flag = 1, d = j.second[1] - j.second[0];
      for (long long int i = 2; i < j.second.size(); i++) {
        if (j.second[i] - j.second[i - 1] != d) {
          flag = 0;
          break;
        }
      }
      if (flag) {
        ans[j.first] = d;
      }
    }
  }
  cout << ans.size() << "\n";
  for (auto j : ans) {
    cout << j.first << " " << j.second << "\n";
  }
}
