#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
vector<int> used;
long long ans = 0;
bool first = 0;
void dfs(int v, int deep = 0) {
  used[v] = 1;
  int count = 0;
  int i = 0;
  if (deep >= 2) ans++;
  for (int x : g[v]) {
    if (!used[x]) count++, dfs(x, deep + 1);
    i++;
  }
  ans += (count * (count - 1)) / 2;
}
int main() {
  int n, m;
  cin >> n;
  m = n - 1;
  g.resize(n + 1);
  used.resize(n + 1, 0);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(1);
  cout << ans << endl;
  return 0;
}
