#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
long long ans = 0;
void dfs(int x, int pr = -1) {
  int ch = 0;
  for (int to : g[x]) {
    if (to == pr) continue;
    ch++;
    dfs(to, x);
    ans += g[to].size() - 1;
  }
  ans += ch * (ch - 1) / 2;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  g.resize(n);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(0);
  cout << ans << endl;
  return 0;
}
