#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    map<int, vector<int>> m;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
      m[v[i]].push_back(i);
    }
    vector<pair<int, int>> res;
    for (auto p : m) {
      vector<int> tmp = p.second;
      if (tmp.size() == 1) {
        res.push_back(make_pair(p.first, 0));
        continue;
      }
      int d = tmp[1] - tmp[0];
      int flag = 0;
      for (int i = 1; i < tmp.size() - 1; i++) {
        int curr = tmp[i + 1] - tmp[i];
        if (curr != d) {
          flag = 1;
          break;
        }
      }
      if (flag == 1) {
        continue;
      }
      res.push_back(make_pair(p.first, d));
    }
    sort((res).begin(), (res).end());
    cout << res.size() << endl;
    for (auto p : res) {
      cout << p.first << " " << p.second << endl;
    }
  }
  return 0;
}
