#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ","
       << " ";
  err(++it, args...);
  cout << printf("\n");
}
bool checkbit(int mask, int bit) { return mask & (1 << bit); }
int setbit(int mask, int bit) { return mask | (1 << bit); }
int clearbit(int mask, int bit) { return mask & ~(1 << bit); }
int togglebit(int mask, int bit) { return mask ^ (1 << bit); }
int bitno(int mask) { return (int)__builtin_popcount(mask); }
const int fx[] = {+1, -1, +0, +0};
const int fy[] = {+0, +0, +1, -1};
const long long maX = 1e5 + 10;
long long dp[maX];
int main() {
  long long n;
  scanf("%lld", &n);
  vector<long long> vc;
  vector<long long> ara[maX];
  long long cc = 0;
  for (long long i = 0; i < n; i++) {
    long long x;
    scanf("%lld", &x);
    if (dp[x] == 0) vc.push_back(x);
    dp[x]++;
    ara[x].push_back(i + 1);
  }
  sort(vc.begin(), vc.end());
  for (long long i = 0; i < vc.size(); i++) {
    if (ara[vc[i]].size() == 1) {
      cc++;
    } else {
      set<long long> st;
      for (long long j = 0; j + 1 < ara[vc[i]].size(); j++) {
        st.insert(ara[vc[i]][j + 1] - ara[vc[i]][j]);
      }
      if (st.size() == 1)
        cc++;
      else
        ara[vc[i]].clear();
    }
  }
  cout << cc << endl;
  for (long long i = 0; i < vc.size(); i++) {
    if (ara[vc[i]].size() > 0) {
      cout << vc[i] << " ";
      if (ara[vc[i]].size() == 1)
        cout << 0 << endl;
      else
        cout << ara[vc[i]][1] - ara[vc[i]][0] << endl;
    }
  }
  return 0;
}
