#include<bits/stdc++.h>

#pragma GCC optimize("O2")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")

#define pii pair<int,int>
#define ii int,int
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define umap unordered_map
#define BIT(mask, i) ((mask >> i)&1)
#define ALL(c) c.begin(), c.end()

using namespace std;

mt19937 rd(chrono::high_resolution_clock::now().time_since_epoch().count());
int rand(int l, int r){
    return  l + rd()*rd()%(r-l+1);
}

const int N = 1e6+7;
const int M = 1e3+3;
const int MOD = 1e9+7;
const int inf = 3e18;

int n;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    map<long long, int> mp;

    for(int i = 1; i <= n; i++){
        long long x;
        cin >> x;
        mp[x]++;
    }   // đếm được mỗi phần tử xuất hiện bao nhiêu lần rồi
    // -> in ra map -> thỏa mãn đề bài
    for(auto i : mp){
        cout << i.first << ' ' << i.second << '\n';
    }
}
