#include <bits/stdc++.h>

using namespace std;
using LL = long long;
const LL LINF = 1e18;
class Edge{
public:
    LL to,from,value;
    Edge(LL t,LL f,LL c){
        to = t;
        from = f;
        value = c;
    }
};

int main(){
    int N;cin >> N;
    vector<int> vec(N);
    for(int a = 0;a < N-1;a++){
        int b,c;cin >> b >> c;
        vec.at(b-1)++;
        vec.at(c-1)++;
    }
    LL ans = 0;
    for(int a = 0;a < N;a++){
        ans += max(vec.at(a)-2,0);
    }
    cout<<ans<<endl;
}