#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1.0);
int bits(int n) {
  int ans = 0;
  while (n) {
    ans += n % 2;
    n /= 2;
  }
  return ans;
}
long long bs(long long a[], long long low, long long high, long long val) {
  long long mid = (low + high) / 2;
  if (low > high) return -1;
  if (a[mid] > val)
    bs(a, low, mid - 1, val);
  else if (a[mid] < val)
    bs(a, mid + 1, high, val);
  else
    return mid;
}
int calc(int n) {
  if (n == 1) return 9;
  int ans = 9 * 4 * (pow(2, n) - 2) + 9 * (pow(2, n - 1) - 1) + 9;
  return ans;
}
map<int, vector<int>> m;
void DJ() {
  int n, i;
  vector<pair<int, int>> p;
  cin >> n;
  int a[n];
  for (i = 0; i < n; ++i) {
    cin >> a[i];
    m[a[i]].push_back(i);
  }
  for (auto c : m) {
    if (c.second.size() == 1) {
      p.push_back({c.first, 0});
      continue;
    }
    int y = c.second[1] - c.second[0];
    for (i = 1; i < c.second.size(); ++i) {
      if (c.second[i] - c.second[i - 1] != y) break;
    }
    if (i == c.second.size()) {
      p.push_back({c.first, y});
    }
  }
  cout << p.size() << "\n";
  for (i = 0; i < p.size(); ++i) {
    cout << p[i].first << " " << p[i].second << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) DJ();
  return 0;
}
