#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 10;
long long int ans = 0;
vector<int> g[MAXN];
int v[MAXN], sz[MAXN], k;
void dfs(int x, int p, int pp, int ct) {
  if (ct == 2) {
    sz[pp]++;
    return;
  }
  ct++;
  for (long long int i = 0; i < g[x].size(); ++i) {
    int u = g[x][i];
    if (p != u) {
      dfs(u, x, p, ct);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n, u, v;
  cin >> n;
  for (long long int i = 0; i < n - 1; ++i) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int st = 1;
  for (long long int i = 1; i < n + 1; ++i) dfs(i, 0, 0, 0);
  int fans = 0;
  for (long long int i = 1; i < n + 1; ++i) fans += sz[i];
  cout << fans / 2 << endl;
}
