#include <iostream>
#include <utility>
#include <vector>
#include <map>
using namespace std;
#define N 100001
vector<int> adj[N];
vector<pair<int,int> > inp;
int x = 0;
bool found = false;
int from = 0;
int to = 0;
map<int,bool> m;
void dfs(int p,int e) {
if (p == x) {
found = true;
return;
}
m[p] = true;
for (int i = 0; i < (int)adj[p].size(); i++) {
if (found) break;
int u = adj[p][i];
if (u == e) {continue;}
if ((p == from && to == u) || (p==to&&u==from)) {continue;}
if (m[u]) continue;
if (u.size() >= 2 || u == x) dfs(u, p);
}
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n; cin.ignore();
for (int i = 1; i <= n; i++) {
int a, b; cin >> a >> b; cin.ignore();
inp.push_back(make_pair(a,b));
adj[a].push_back(b);
adj[b].push_back(a);
}
int res = 0;
for (int i = 0; i < n; i++) {
pair<int,int> p = inp[i];
int a=p.first,b=p.second;
m.clear();
from=a,to=b;
x=b;
found=false;
dfs(a,0);
if (!found) {
res++;
}
}
cout<<res;
return 0;
}