#include #include #include using namespace std; int N,C[100010],a,b; int upp = 1e5; int visited[100010] = {}; int cnt = 0; bool judge = true; vector> v(100010); bool dfs(int n,int m){ cnt++; visited[n] = 1; for(auto x:v[n]){ if(x!=m && visited[x]==0) dfs(x,n); else if(x!=m && visited[x]==1) judge = false; } } int main(){ cin >> N; assert(N<=upp); for(int i=0;i> a >> b; v[a].push_back(b); v[b].push_back(a); C[a]++; C[b]++; } dfs(1,0); assert(judge && cnt==N); int ans = 0; for(int i=1;i<=N;i++){ ans += max(C[i]-2,0); } cout << ans << endl; }