#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
const int N = 10005;
long long ans = 0;
vector<int> g[N];
void dfs(int v, int pr = -1) {
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (to == pr) {
      continue;
    }
    dfs(to, v);
    ans += (g[to].size() - 1);
  }
  long long first = g[v].size() - (pr != -1);
  ans += first * (first - 1) / 2;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int q, w;
    cin >> q >> w;
    g[q].push_back(w);
    g[w].push_back(q);
  }
  dfs(1);
  cout << ans;
}
