#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e5 + 17, N = 5e3 + 17, MOD = 1e9 + 7, Mod = 1e9 + 6;
long long n, m, ans, d[maxN], x, y;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (long long i = 1; i <= n - 1; i++)
    cin >> x >> y, ans += d[x] + d[y], d[x]++, d[y]++;
  return cout << ans << "\n", 0;
}
