#include using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) int main(void){ int n; cin >> n; vector pocty(n); for (int i = 0; i < n-1; i++) { int a, b; cin >> a >> b; a--; b--; pocty[a]++; pocty[b]++; } int ans = 0; for (int& i : pocty) if (i >= 3) ans += i-2; cout << ans << endl; }