#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1E5+2;
int n;
int ans = 0;
vector<vector<int> > g;
vector<int> par(MAXN, -1);
vector<bool> used(MAXN, 0);
vector<int> s;
void bfs(){
queue<int> q; q.push(0);
while(!q.empty()){
int u = q.front(); q.pop();
s.push_back(u);
for(int v : g[u]){
if(v!= par[u]){
par[v] = u;
q.push(v);
}
}
}
}
int main() {
cin >> n; g.assign(n, vector<int>());
for(int i=1; i< n; ++i){
int u, v; cin >> u >> v; --u; --v;
g[u].push_back(v);
g[v].push_back(u);
}
bfs();
for(int i= n-1; i>=0; --i){
if(used[s[i]]) continue;
if(par[s[i]]!= -1 && !used[par[s[i]]]){
++ans;
used[s[i]] = used[par[s[i]]] = 1;
}
}
cout << ans;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgTUFYTiA9IDFFNSsyOwppbnQgbjsKaW50IGFucyA9IDA7CnZlY3Rvcjx2ZWN0b3I8aW50PiA+IGc7CnZlY3RvcjxpbnQ+IHBhcihNQVhOLCAtMSk7CnZlY3Rvcjxib29sPiB1c2VkKE1BWE4sIDApOwp2ZWN0b3I8aW50PiBzOwoKdm9pZCBiZnMoKXsKCXF1ZXVlPGludD4gcTsgcS5wdXNoKDApOwoJd2hpbGUoIXEuZW1wdHkoKSl7CgkJaW50IHUgPSBxLmZyb250KCk7IHEucG9wKCk7CgkJcy5wdXNoX2JhY2sodSk7CgkJZm9yKGludCB2IDogZ1t1XSl7CgkJCWlmKHYhPSBwYXJbdV0pewoJCQkJcGFyW3ZdID0gdTsKCQkJCXEucHVzaCh2KTsKCQkJfQoJCX0KCX0KfQoKaW50IG1haW4oKSB7CgljaW4gPj4gbjsgZy5hc3NpZ24obiwgdmVjdG9yPGludD4oKSk7Cglmb3IoaW50IGk9MTsgaTwgbjsgKytpKXsKCQlpbnQgdSwgdjsgY2luID4+IHUgID4+IHY7IC0tdTsgI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