#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include using namespace std; int main() { int n; cin >> n; vectorp(n); vector>x(n); for (int i = 0; i < n - 1; i++) { int a, b; cin >> a >> b; a--; b--; p[a]++; p[b]++; x[a].push_back(b); x[b].push_back(a); } long long int ans = 0; for (int i = 0; i < n; i++) { if (p[i] > 2)ans += p[i] - 2; } cout << ans << endl; return 0; }