#include using namespace std; typedef long long ll; typedef pair pii; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector numAdj(n, 0); for (int i = 0; i < n - 1; i++) { int a, b; cin >> a >> b; a--; b--; numAdj[a]++; numAdj[b]++; } int res = 0; for (int i = 0; i < n; i++) { res += max(0, numAdj[i] - 2); } cout << res << "\n"; return 0; }