#include using namespace std; typedef long long ll; typedef double lf; typedef pair pii; typedef pair pll; #define TRACE(x) cerr << #x << ' ' << x << endl #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define _ << ' ' << #define fi first #define sec second #define se second #define mp make_pair #define pb push_back const int MAXN = 300100; int n; vector v[MAXN]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; REP(i, n - 1) { int a, b; cin >> a >> b; v[a].pb(b); v[b].pb(a); } ll sol = 0; REP(i, MAXN) { sol += max(0, (int)v[i].size() - 2); } cout << sol << endl; return 0; }