#include using namespace std; using ll = long long; int main(){ int n; cin >> n; vector deg(n,0); vector> es(n-1); for (int i = 0; i < n-1; i++){ int u, v; cin >> u >> v; u--, v--; deg[u]++; deg[v]++; es[i] = pair(u,v); } ll ans = n-1; for (int v = 0; v < n; v++){ ans += deg[v] * (deg[v]-1) / 2; } for (auto [u, v] : es){ ans += (deg[u] - 1) * (deg[v] - 1); } cout << ans << endl; }