#include <bits/stdc++.h>
using namespace std;
long long suf(long long a) { return (a * (a + 1)) / 2; }
const long long OO = 1e6 + 10, MOD = 1e9 + 7;
vector<vector<int> > adj, can;
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
int main() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k, a, b, c, d;
  string s, s1;
  char ch;
  while (cin >> n) {
    vector<vector<int> > v(1e5 + 5);
    vector<pair<int, int> > ans;
    for (int i = 0; i < n; i++) {
      cin >> a;
      v[a].push_back(i + 1);
    }
    for (int i = 0; i < v.size(); i++) {
      if (v[i].size() == 1)
        ans.push_back({i, 0});
      else if (v[i].size() > 1) {
        int now = v[i][1] - v[i][0];
        bool ok = true;
        for (int j = 2; j < v[i].size(); j++) {
          if (v[i][j] - v[i][j - 1] != now) {
            ok = false;
            break;
          }
        }
        if (ok) ans.push_back({i, now});
      }
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++)
      cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}
