#include<bits/stdc++.h>
using namespace std;

const int N = 3e5 + 5;
int kol[N];
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >>n;
    for (int i =1; i < n; ++i){
        int x, y;
        cin >>x>>y;
        kol[x]++;
        kol[y]++;
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i){
        if (kol[i] > 2)ans += kol[i] - 2;
    }
    cout <<ans;
}

