#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
#define files \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define ll long long
#define rep(ii, beg, till, inc) for (int ii = beg; ii < till; ii += inc)
#define repr(ii, beg, till, inc) for (int ii = beg - 1; ii >= till; ii -= inc)
const ll MOD = 1e9 + 7;
const int MXN = 2e5 + 5;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int edges = 0;
vector<int> graph[MXN];
int dfs(int node, int par)
{
int one = 0;
for (int child : graph[node])
{
if (child == par)
continue;
int cur = dfs(child, node);
edges += cur == 2;
one += cur == 1;
}
one = one != 0;
++one;
edges += one == 2;
one %= 2;
return one;
}
void sol(int tc)
{
int node;
cin >> node;
rep(ii, 1, node, 1)
{
int u, v;
cin >> u >> v;
graph[u].push_back(v);
swap(u, v);
graph[u].push_back(v);
}
dfs(1, 1);
cout << edges << "\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
// cin >> T;
for (int ii = 1; ii <= T; ++ii)
sol(ii);
}
CiNwcmFnbWEgR0NDIG9wdGltaXplKCJPMyx1bnJvbGwtbG9vcHMiKQojcHJhZ21hIEdDQyB0YXJnZXQoImF2eDIsYm1pLGJtaTIsbHpjbnQscG9wY250IikKCiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBmaWxlcyAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICBmcmVvcGVuKCJpbnB1dC50eHQiLCAiciIsIHN0ZGluKTsgXAogICAgZnJlb3Blbigib3V0cHV0LnR4dCIsICJ3Iiwgc3Rkb3V0KTsKCiNkZWZpbmUgcmFsbCh4KSB4LnJiZWdpbigpLCB4LnJlbmQoKQoj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CiAgICAgICAgc3dhcCh1LCB2KTsKICAgICAgICBncmFwaFt1XS5wdXNoX2JhY2sodik7CiAgICB9CiAgICBkZnMoMSwgMSk7CiAgICBjb3V0IDw8IGVkZ2VzIDw8ICJcbiI7Cn0KCmludCBtYWluKCkKewogICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZShudWxscHRyKTsKCiAgICBpbnQgVCA9IDE7CiAgICAvLyBjaW4gPj4gVDsKICAgIGZvciAoaW50IGlpID0gMTsgaWkgPD0gVDsgKytpaSkKICAgICAgICBzb2woaWkpOwp9Cg==