#include <bits/stdc++.h>
const int OO = (long long)2e9;
const double eps = 1e-9;
const long long MAX = 100001;
using namespace std;
int n, a, k;
map<int, vector<int> > mp;
pair<int, int> p[MAX];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) {
    scanf("%d", &a);
    mp[a].push_back(i + 1);
  }
  map<int, vector<int> >::iterator it = mp.begin();
  while (it != mp.end()) {
    int SZ = it->second.size();
    if (SZ == 1) {
      p[k].first = it->first, p[k].second = 0;
      k++;
    } else {
      bool ch = 0;
      for (int j = (1); j < (SZ - 1); ++j) {
        if (it->second[j] - it->second[j - 1] ==
            it->second[j + 1] - it->second[j])
          continue;
        else {
          ch = 1;
          break;
        }
      }
      if (!ch)
        p[k].first = it->first, p[k].second = it->second[1] - it->second[0],
        k++;
    }
    it++;
  }
  printf("%d\n", k);
  for (int i = (0); i < (k); ++i) printf("%d %d\n", p[i].first, p[i].second);
  return 0;
}
