#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
bool vis[100010];
int last[100010], ans[100010];
inline void solve() {
  memset(vis, 0, sizeof vis);
  memset(ans, 0, sizeof ans);
  set<int> s;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    if (!vis[x]) {
      s.insert(x);
      vis[x] = 1;
    } else {
      if (ans[x] && ans[x] != i - last[x]) s.erase(x);
      ans[x] = i - last[x];
    }
    last[x] = i;
  }
  printf("%d\n", ((int)(s).size()));
  for (set<int>::iterator it = s.begin(); it != s.end(); it++)
    printf("%d %d\n", *it, ans[*it]);
}
int main() {
  solve();
  return 0;
}
