#include using namespace std; using ll = long long; using Vi = vector; using Pii = pair; #define mp make_pair #define pb push_back #define x first #define y second #define rep(i,b,e) for(int i = (b); i < (e); i++) #define each(a, x) for(auto& a : (x)) #define all(x) (x).begin(),(x).end() #define sz(x) int((x).size()) void solve() { int n; cin >> n; Vi deg(n+1); for (int i = 0; i < n-1; i++) { int a, b; cin >> a >> b; deg[a]++; deg[b]++; } int res = 0; for (int i = 1; i <= n; i++) { res += max(0, deg[i] - 2); } cout << res << endl; } int main() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(12); solve(); return 0; }