#include using namespace std; using ll = long long; int main() { int n; cin >> n; vector dig(n); for(int i = 0; i < n - 1; i++) { int a, b; cin >> a >> b; dig[a]++;dig[b]++; } int cnt = 0; for(auto i : dig)cnt += max(0, i - 2); cout << cnt << endl; }