#include <bits/stdc++.h>
using namespace std;
const int X = 100005;
int a[X];
bool vis[X], valid[X];
map<int, int> mp, mp3;
map<int, pair<int, int> > mp2;
vector<pair<int, int> > v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(valid, 1, sizeof valid);
  int n, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a[i] = x;
    mp[x]++;
    if (mp[x] <= 2) {
      mp2[x].first = i - mp2[x].second;
      mp2[x].second = i;
    }
  }
  for (int i = 0; i < n; i++) {
    x = a[i];
    mp3[x]++;
    if (mp3[x] > 2) {
      if (i - mp2[x].second != mp2[x].first) {
        valid[x] = 0;
      }
      mp2[x].second = i;
    }
  }
  for (int i = 0; i < n; i++) {
    x = a[i];
    if (valid[x] && !vis[x]) {
      vis[x] = 1;
      if (mp[x] == 1)
        v.push_back({x, 0});
      else
        v.push_back({x, mp2[x].first});
    }
  }
  sort(v.begin(), v.end());
  cout << v.size() << "\n";
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second << "\n";
  }
  return 0;
}
