#include <bits/stdc++.h>
using namespace std;
const char nxtl = (char)'\n';
const int maxn = (int)2e5 + 5;
const int INF_INT = (int)1e9 + 99;
const long long INF_BIG = (long long)1e18 + 99;
const int MOD = (int)1e9 + 7;
int cnt = 0, res = 0;
vector<int> g[15000];
bool used[15000];
map<pair<int, int>, bool> Used;
void dfs(int x, int lvl, int begin) {
  used[x] = 1;
  if (lvl == 2) {
    cnt++;
    return;
  }
  for (auto it : g[x]) {
    if (!used[it]) {
      dfs(it, lvl + 1, begin);
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; ++i) {
    cnt = 0;
    memset(used, 0, sizeof used);
    dfs(i, 0, i);
    res += cnt;
  }
  cout << res / 2;
  return 0;
}
