#include using namespace std; int main() { int N,a,b; cin >> N; int pole[N]; for (int j = 0; j < N; ++j) { pole[j] = 0; } for (int i = 0; i < N-1; ++i) { cin >> a >> b; pole[a]++; pole[b]++; } bool hasEnd = false; int output = 0; for (int k = 0; k < N; ++k) { if(pole[k]==1) hasEnd = true; if(pole[k]>1) output += pole[k]-2; } if(!hasEnd && N>1 && output == 0) output++; cout << output; return 0; }