#include #include #include #include #include #include #include #include #include #include #include #include #include #include // std::stringstream #include #include using namespace atcoder; using mint = modint998244353; //using mint = modint1000000007; using namespace std; using ll = long long; static const double pi = 3.141592653589793; const int INF = (1 << 29); const ll mod = 998244353; // ifstream ifs(""); template void print(T& a){cout<> n; vector Graph(n,vector()); for(int i=0;i> u >> v; u--;v--; Graph[u].push_back(v); Graph[v].push_back(u); } for(int i=0;i visited(n,false); vector dist(n,1e9); queue que; que.push(i); set S; dist[i]=0; while(!que.empty()){ int now = que.front();que.pop(); visited[now] = true; for(auto x:Graph[now]){ if(visited[x]) continue; if(dist[now]+1==2) { S.insert(x); continue; }else{ dist[x] = min(dist[x],dist[now]+1); que.push(x); } } } cout << S.size() << endl; } }