#include <bits/stdc++.h>
using namespace std;
int n, arr[(int)1e5 + 5], prv[(int)1e5 + 5];
map<int, int> mp;
vector<pair<int, int> > ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", arr + i);
    if (!prv[arr[i]])
      prv[arr[i]] = i, mp[arr[i]] = 0;
    else if (mp[arr[i]] == -1)
      continue;
    else if (!mp[arr[i]])
      mp[arr[i]] = i - prv[arr[i]];
    else if (i - prv[arr[i]] != mp[arr[i]])
      mp[arr[i]] = -1;
    prv[arr[i]] = i;
  }
  for (map<int, int>::iterator it = mp.begin(); it != mp.end(); ++it)
    if ((it->second) != -1) ans.push_back({it->first, it->second});
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); ++i)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
