#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
void sync_stdio() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
}
struct Sync_stdio {
  Sync_stdio() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
  }
} _sync_stdio;
struct FAIL {
  FAIL() {
    cout << "CHANGE!!!"
         << "\n";
  }
};
vector<vector<int>> g;
vector<int> used;
int res = 0;
void dfs(int x) {
  used[x] = 1;
  int tres = 0;
  for (auto i : g[x]) {
    ++tres;
    if (used[i]) {
      continue;
    }
    dfs(i);
  }
  res += (tres - 1) * tres / 2;
}
int main() {
  int n;
  cin >> n;
  used.resize(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 << res;
}
