#include #include int input() { int ret = 0; char c = getchar_unlocked(); while ('0' <= c && c <= '9') { ret = ret * 10 + (c - '0'); c = getchar_unlocked(); } return ret; } int main() { int n = input(); std::vector cnt(n); for (int i = 0; i < n - 1; ++i){ ++cnt[input() - 1]; ++cnt[input() - 1]; } int ans = 0; for (int a : cnt) if (a > 2)ans += a - 2; printf("%d", ans); }