#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int n, sum1 = 0, res1 = 0, last = 0;     bool flag = true;     cin >> n;     unordered_map<long long int, long long int> m;     vector<pair<long long int, long long int>> v;     for (long long int i = 0; i < n; i++) {       long long int element;       cin >> element;       m[element]++;       v.emplace_back(make_pair(element, i));     }     if (n == 1) {       cout << 1 <<   n ;       cout << v[0].first <<                <<  0 n ;       return 0;     }     sort(v.begin(), v.end());     vector<pair<long long int, long long int>> v1;     for (long long int i = 0; i < v.size() - 1; i++) {       flag = true;       if (i < v.size() - 1 && v[i].first == v[i + 1].first)         sum1 = v[i + 1].second - v[i].second;       else if (i < v.size() - 1)         sum1 = 0;       while (i < v.size() - 1 && v[i].first == v[i + 1].first) {         res1 = v[i + 1].second - v[i].second;         if (res1 != sum1) {           flag = false;           break;         }         i++;       }       if (flag == true) {         v1.push_back(make_pair(v[i].first, sum1));       }       while (i < v.size() - 1 && v[i].first == v[i + 1].first) {         i++;       }     }     if (v[v.size() - 1].first != v[v.size() - 2].first) {       v1.emplace_back(make_pair(v[v.size() - 1].first, 0));     }     cout << v1.size() <<   n ;     for (long long int i = 0; i < v1.size(); i++) {       cout << v1[i].first <<     << v1[i].second <<   n ;     }     return 0;   }   