#include using namespace std; typedef long long ll; const int S = (1 << 20); int n, x, y, ans = -1; vector G[S]; bool odw[S]; void dfs(int node){ odw[node] = true; for (auto e : G[node]) if (!odw[e]){ dfs(e); return; } } int main(){ ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); cin >> n; for (int i = 0; i < n - 1; i ++){ cin >> x >> y; G[x].push_back(y); G[y].push_back(x); } for (int i = 1; i <= n; i ++) if (!odw[i]){ ans ++; dfs(i); } cout << ans << endl; return 0; }