#include using namespace std; using ll = long long; #define rep(i, n) for(ll i = 0; i < n; i++) int main() { int N; cin >> N; vector> g(N); rep(i, N - 1) { int u, v; cin >> u >> v; u--; v--; g[u].push_back(v); g[v].push_back(u); } using P = pair; using T = tuple; set

st; rep(i, N) { queue q; q.push(T(i, 0, -1)); while(q.size()) { int u, d, p; tie(u, d, p) = q.front(); q.pop(); if(d >= 3) continue; for( int e : g[u]) { if(e == p) continue; int a = e; int b = i; if(a > b) swap(a, b); st.insert(P(a, b)); q.push(T(e, d + 1, u)); } } } cout << st.size() << endl; }