#include <bits/stdc++.h>
using namespace std;
const int maxn = 10005;
const int logn = 18;
const int inf = (int)1e9 + 5;
const long long mod = (long long)1e9 + 7;
const long long base = 2204234849;
const long long l_inf = (long long)4e18;
const long double pi = acos(-1.0);
const long double eps = 1e-12;
int n;
int deg[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(20);
  cout << fixed;
  srand(566);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int v, u;
    cin >> v >> u;
    deg[--v]++;
    deg[--u]++;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) ans += deg[i] * (deg[i] - 1) / 2;
  cout << ans;
  return 0;
}
