#include using namespace std; #define FOR(i, n) for(int i = 0; i < (n); ++i) #define f first #define s second #define pb push_back #define all(x) x.begin(), x.end() #define vi vector #define SZ(x) ((int)(x).size()) typedef long long ll; const int N = 1e6+7; int st[N]; int n; int main(){ std::ios_base::sync_with_stdio(false); std::cin.tie(0); cin >> n; FOR(i, n-1){ int a, b; cin >> a >> b; st[a]++; st[b]++; } int ans = 0; for(int i = 1; i <= n; i++){ if(st[i] > 2) ans += st[i]-2; } cout << ans << '\n'; return 0; }