#include "bits/stdc++.h" using namespace std; void solve() { int n, ans = 0; cin >> n; map mp; for (int x = 0; x < n - 1; x++) { int a, b; cin >> a >> b; mp[a]++; mp[b]++; } for (auto p : mp) { ans += max(p.second - 2, 0); } cout << ans << endl; } int main(void) { solve(); //cout << "yui(*-v・)yui" << endl; return 0; }