#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include using namespace std; vector>f; int main() { int n; cin >> n; f.resize(n,vector(n)); //cout << f[0].size(); vectorp(n); vector>x(n); for (int i = 0; i < n - 1; i++) { int a, b; cin >> a >> b; a--; b--; p[a]++; p[b]++; x[a].push_back(b); x[b].push_back(a); f[a][b] = 1; f[b][a] = 1; } long long int ans = 0; for (int i = 0; i < n; i++) { sort(x[i].begin(), x[i].end()); if (p[i] >= 2)ans += p[i] - 2; for (int j = 0; j < x[i].size(); j++) { f[i][x[i][j]] = 0; p[x[i][j]]--; } } cout << ans << endl; return 0; }