#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-15;
const double pi = acos(-1.0);
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const int N = 1e4 + 5;
vector<int> g[N];
long long ans = 0;
void dfs(int cur, int par, int Life) {
  if (Life == 3) {
    ans++;
    Life = 2;
  }
  long long sz = (long long)g[cur].size();
  if (cur != 1) {
    sz--;
  }
  ans += sz * (sz - 1) / 2;
  for (auto i : g[cur]) {
    if (i != par) {
      dfs(i, cur, Life + 1);
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n;
  cin >> n;
  while (n-- > 1) {
    int x, y;
    cin >> x >> y;
    g[x].emplace_back(y);
    g[y].emplace_back(x);
  }
  dfs(1, -1, 1);
  cout << ans << '\n';
  return 0;
}
