#include <bits/stdc++.h>
using namespace std;
bool vis[100005], cant[100005];
int a;
map<int, int> m;
int ans[100005], last_pos[100005];
int main() {
  int n;
  while (cin >> n) {
    memset(last_pos, 0, sizeof(last_pos));
    memset(ans, 0, sizeof(ans));
    memset(cant, 0, sizeof(cant));
    memset(vis, 0, sizeof(vis));
    int co = 0;
    for (int i = 1; i <= n; i++) {
      cin >> a;
      if (last_pos[a] == 0) {
        co++;
        m[a] = 0;
        last_pos[a] = i;
      } else {
        vis[a] = true;
        if (ans[a] == 0) {
          ans[a] = i - last_pos[a];
        } else if (ans[a] != i - last_pos[a]) {
          if (!cant[a]) co--;
          cant[a] = true;
        }
        m[a] = i - last_pos[a];
        last_pos[a] = i;
      }
    }
    map<int, int>::iterator it = m.begin();
    printf("%d\n", co);
    for (; it != m.end(); it++) {
      if (vis[it->first] && !cant[it->first]) {
        printf("%d %d\n", it->first, ans[it->first]);
      } else if (!cant[it->first])
        printf("%d 0\n", it->first);
    }
  }
  return 0;
}
