#include <bits/stdc++.h>
using namespace std;
long long dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
long long dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
const long double pi = 3.141592653589;
const long long INF = 1e18;
const long long mod = 1000000007;
const long long maxn = 1e4 + 5;
template <typename T>
void printv(const vector<T>& v) {
  for (auto i : v) cout << i << ' ';
  cout << '\n';
}
template <typename T>
void printv(const vector<pair<T, T>>& v) {
  for (auto p : v) cout << "(" << p.first << "," << p.second << "),";
  cout << '\n';
}
long long n;
vector<long long> g[maxn];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  cin >> n;
  for (long long i = 1; i <= n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    ans += (g[i].size() * (g[i].size() - 1) / 2);
  }
  cout << ans << '\n';
  return 0;
}
