#include <bits/stdc++.h>
using namespace std;
map<int, pair<int, pair<int, int> > > mp;
map<int, int> mp1;
int n, num;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> num;
    if (mp[num].second.second == 0) {
      mp[num].second.first = 0;
    } else if (mp[num].second.second == 1) {
      mp[num].second.first = i - mp[num].first;
    } else {
      if (i - mp[num].first == mp[num].second.first) {
      } else
        mp[num].second.first = -1;
    }
    mp[num].second.second++;
    mp[num].first = i;
  }
  for (map<int, pair<int, pair<int, int> > >::iterator it = mp.begin();
       it != mp.end(); it++)
    if (it->second.second.first != -1) mp1[it->first] = it->second.second.first;
  if (mp1.size() != 0) {
    cout << mp1.size() << endl;
    for (map<int, int>::iterator it = mp1.begin(); it != mp1.end(); it++)
      cout << it->first << " " << it->second << endl;
  } else
    cout << 0;
  return 0;
}
