#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const long double PI = acosl((long double)-1.0);
const long long LINF = 1e18;
const int MOD = 1000000007;
int n;
vector<vector<int> > g;
void init() {
  scanf("%d", &n);
  g.resize(n + 1);
  for (int i = 1; i < n; i++) {
    int v1, v2;
    scanf("%d%d", &v1, &v2);
    g[v1].push_back(v2);
    g[v2].push_back(v1);
  }
}
void solve() {
  init();
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += g[i].size() * ((int)g[i].size() - 1) / 2;
  }
  printf("%lld\n", ans);
}
void precalc() {}
int main() {
  srand(25);
  precalc();
  int tests = 1;
  for (int i = 1; i <= tests; i++) {
    solve();
  }
  return 0;
}
