#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define llong long long int main() { int n; cin >> n; vector lines(n); int result = 0; rep(i, n-1) { int a, b; cin >> a >> b; if (lines[a-1] < 2) lines[a-1] += 1; else result += 1; if (lines[b-1] < 2) lines[b-1] += 1; else result += 1; } cout << result << "\n"; }