#include <bits/stdc++.h>   using namespace std;   set<int> cn[10000];   int nx[10000];   string xm[10000];   int main() {     int m;     cin >> m;     ;     map<string, int> mx;     int n = 0;     for (int i = (0); i < m; i++) {       string a, b;       cin >> a >> b;       if (!mx.count(a)) mx[a] = n, xm[n++] = a;       if (!mx.count(b)) mx[b] = n, xm[n++] = b;       cn[mx[a]].insert(mx[b]);       cn[mx[b]].insert(mx[a]);     }     cout << n << endl;     for (int i = (0); i < n; i++) {       memset(nx, 0, sizeof(nx));       int my = -1, cmy = 0;       for (auto f : cn[i]) {         for (auto fx : cn[f]) {           if (fx == i || cn[fx].count(i)) continue;           nx[fx]++;           if (nx[fx] > my)             my = nx[fx], cmy = 1;           else if (nx[fx] == my)             cmy++;         }       }       if (cmy == 0) {         cmy = n - 1 - cn[i].size();       }       cout << xm[i] <<     << cmy << endl;     }     return 0;   }   