#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d %d", &a, &b)
#define sc3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N = 2e5 + 100;
vi g[N];
vector<ll> prof[N];
ll quantos_pares[N], quantos_impares[N], sum_pares[N], sum_impares[N];
ll resp = 0;

void merge(int root1, int root2) {
  ll level = 1;
  for (int i = (int)prof[root1].size() - 1; i >= 0; i--) {
    if (level % 2) {
      resp = resp + level * prof[root1][i] * sum_impares[root2];
      resp = resp + level * prof[root1][i] * sum_pares[root2] +
             quantos_pares[root2];
    } else {
      resp = resp + level * prof[root1][i] * sum_impares[root2] +
             quantos_impares[root2];
      resp = resp + level * prof[root1][i] + sum_pares[root2];
    }
    level++;
  }
  int vai = prof[root2].size() - 1;
  for (int i = (int)prof[root1].size() - 1; i >= 0; i--) {
    prof[root2][vai] += prof[root1][i];
    vai--;
  }
  sum_pares[root2] += sum_pares[root1];
  sum_impares[root2] += sum_impares[root1];
  quantos_pares[root2] += quantos_pares[root1];
  quantos_impares[root2] += quantos_impares[root1];
}
int dfs(int u, int last) {
  int root = u;
  for (int v : g[u]) {
    if (v == last)
      continue;
    int root2 = dfs(v, u);
    prof[root2].pb(1);
    int novo = prof[root2].size();
    if (novo % 2 == 0) {
      quantos_pares[root2]++, sum_pares[root2] += novo;
    } else {
      quantos_impares[root2]++, sum_impares[root2] += novo;
    }

    if (prof[root2].size() <= prof[root].size()) {
      merge(root2, root);
    } else {
      merge(root, root2);
      root = root2;
    }
  }
  resp = resp + sum_pares[root] + sum_impares[root] + quantos_impares[root];
  return root;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    g[u].pb(v);
    g[v].pb(u);
  }
  dfs(1, 1);
  cout << resp / 2ll << endl;
}


#include <bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d %d", &a, &b)
#define sc3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define db(x) cerr << #x << " == " << x << endl;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
const int N = 2e5 + 100;
vi g[N];
vector<ll> prof[N];
ll quantos_pares[N], quantos_impares[N], sum_pares[N], sum_impares[N];
ll resp = 0;

void merge(int root1, int root2) {
  ll level = 1;
  for (int i = (int)prof[root1].size() - 1; i >= 0; i--) {
    if (level % 2) {
      resp = resp + quantos_impares[root2] * level + sum_impares[root2];
      resp = resp + quantos_pares[root2] * level + sum_pares[root2] +
             quantos_pares[root2];
    } else {
      resp = resp + quantos_impares[root2] * level + sum_impares[root2] +
             quantos_impares[root2];
      resp = resp + quantos_pares[root2] * level + sum_pares[root2];
    }
    level++;
  }
  int vai = prof[root2].size() - 1;
  for (int i = (int)prof[root1].size() - 1; i >= 0; i--) {
    prof[root2][vai] += prof[root1][i];
    vai--;
  }
  sum_pares[root2] += sum_pares[root1];
  sum_impares[root2] += sum_impares[root1];
  quantos_pares[root2] += quantos_pares[root1];
  quantos_impares[root2] += quantos_impares[root1];
}
int dfs(int u, int last) {
  int root = u;
  for (int v : g[u]) {
    if (v == last)
      continue;
    int root2 = dfs(v, u);
    prof[root2].pb(1);
    int novo = prof[root2].size();
    if (novo % 2 == 0) {
      quantos_pares[root2]++, sum_pares[root2] += novo;
    } else {
      quantos_impares[root2]++, sum_impares[root2] += novo;
    }

    if (prof[root2].size() <= prof[root].size()) {
      merge(root2, root);
    } else {
      merge(root, root2);
      root = root2;
    }
  }
  int root1 = root;
  resp = resp + sum_pares[root1] + sum_impares[root1] + quantos_impares[root1];
  return root;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    g[u].pb(v);
    g[v].pb(u);
  }
  dfs(1, 1);
  cout << resp / 2 << endl;
}


#include <iostream>
#include <ios>
#include <cstdint>
#include <vector>
#include <string>
#include <random>
#include <utility>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <set>
#include <complex>

using ul = std::uint32_t;
using li = std::int32_t;
using ull = std::uint64_t;
using ll = std::int64_t;
using vul = std::vector<ul>;
using vvul = std::vector<vul>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;
using vvvb = std::vector<vvb>;
using vull = std::vector<ull>;
using vli = std::vector<li>;
using vll = std::vector<ll>;
using pulul = std::pair<ul, ul>;
using vpulul = std::vector<pulul>;

const ul sz = 1 << 18;
std::mt19937 rands;

ul n;
std::vector<std::set<ul>> edges(2e5 + 1);

vul tree(sz << 1, 0);

void change(ul v, ul pos)
{
	for (tree[pos |= sz] = v, pos >>= 1; pos; pos >>= 1) {
		tree[pos] = tree[pos << 1] + tree[pos << 1 | 1];
	}
}

ul query(ul x)
{
	ul pos = 1;
	for ( ; pos < sz; ) {
		if (x < tree[pos << 1]) {
			pos = pos << 1;
		} else {
			pos = pos << 1 | 1;
			x -= tree[pos ^ 1];
		}
	}
	return pos & ~sz;
}

vpulul edgs(2e5);

vull ans(2e5, 0);

vul cnta;
vul cntb;

void search(ul curr, ul dep, vul& cnt, ul prev)
{
	while (cnt.size() <= dep) {
		cnt.push_back(0);
	}
	++cnt[dep];
	for (ul nex : edges[curr]) {
		if (prev == nex) {
			continue;
		}
		search(nex, dep + 1, cnt, curr);
	}
}

using llf = long double;
using comp = std::complex<long double>;
const long double pi = std::acos((long double)(-1.0));

void fft(comp* p, ul n, int oper)
{
	for (ul i = 0, j = 0; i != n; ++i) {
		if (i < j) {
			std::swap(p[i], p[j]);
		}
		ul k = n >> 1;
		while (k & j) {
			j &= ~k;
			k >>= 1;
		}
		j |= k;
	}
	for (ul d = 0; (1 << d) < n; ++d) {
		ul m = 1 << d;
		ul m2 = m << 1;
		llf p0 = pi / llf(m) * llf(oper);
		comp w0(std::cos(p0), std::sin(p0));
		comp w;
		comp t;
		for (ul i = 0; i != n; i += m2) {
			w = 1;
			for (ul j = 0; j != m; ++j) {
				comp &p1 = p[i + j + m], &p2 = p[i + j];
				t = w * p1;
				p1 = p2 - t;
				p2 = p2 + t;
				w = w * w0;
			}
		}
	}
	if (oper < 0) {
		llf a = llf(1) / llf(n);
		for (ul i = 0; i != n; ++i) {
			p[i] = p[i] * a;
		}
	}
}

comp pa[sz];
comp pb[sz];

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	rands.seed(std::time(0));
	std::cin >> n;
	for (ul i = 1; i != n; ++i) {
		ul u, v;
		std::cin >> u >> v;
		edges[u].insert(v);
		edges[v].insert(u);
		edgs[i].first = u;
		edgs[i].second = v;
		change(1, i);
	}
	while (tree[1]) {
		ul x = query(rand() % tree[1]);
		change(0, x);
		ul a = edgs[x].first;
		ul b = edgs[x].second;
		edges[a].erase(b);
		edges[b].erase(a);
		cnta.resize(0);
		cntb.resize(0);
		search(a, 0, cnta, 0);
		search(b, 0, cntb, 0);
		ul tn = 1;
		while (tn < cnta.size() - 1 + cntb.size() - 1 + 1) {
			tn = tn << 1;
		}
		for (ul i = 0; i != cnta.size(); ++i) {
			pa[i] = cnta[i];
		}
		for (ul i = cnta.size(); i != tn; ++i) {
			pa[i] = 0;
		}
		for (ul i = 0; i != cntb.size(); ++i) {
			pb[i] = cntb[i];
		}
		for (ul i = cntb.size(); i != tn; ++i) {
			pb[i] = 0;
		}
		fft(pa, tn, 1);
		fft(pb, tn, 1);
		for (ul i = 0; i != tn; ++i) {
			pa[i] *= pb[i];
		}
		fft(pa, tn, -1);
		for (ul i = 0; i != tn && i + 1 < 2e5; ++i) {
			ans[i + 1] += llround(pa[i].real());
		}
	}
	ull out = 0;
	for (ul i = 1; i != 2e5; ++i) {
		out += ull(i + 1 >> 1) * ans[i];
	}
	std::cout << out << std::endl;
	return 0;
}


#include <iostream>
#include <ios>
#include <cstdint>
#include <vector>
#include <string>
#include <random>
#include <utility>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <set>
#include <complex>

using ul = std::uint32_t;
using li = std::int32_t;
using ull = std::uint64_t;
using ll = std::int64_t;
using vul = std::vector<ul>;
using vvul = std::vector<vul>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;
using vvvb = std::vector<vvb>;
using vull = std::vector<ull>;
using vli = std::vector<li>;
using vll = std::vector<ll>;
using pulul = std::pair<ul, ul>;
using vpulul = std::vector<pulul>;

const ul sz = 1 << 18;
std::mt19937 rands;

ul n;
std::vector<std::set<ul>> edges(2e5 + 1);

vul tree(sz << 1, 0);

void change(ul v, ul pos)
{
	for (tree[pos |= sz] = v, pos >>= 1; pos; pos >>= 1) {
		tree[pos] = tree[pos << 1] + tree[pos << 1 | 1];
	}
}

ul query(ul x)
{
	ul pos = 1;
	for ( ; pos < sz; ) {
		if (x < tree[pos << 1]) {
			pos = pos << 1;
		} else {
			pos = pos << 1 | 1;
			x -= tree[pos ^ 1];
		}
	}
	return pos & ~sz;
}

vpulul edgs(2e5);

vull ans(2e5, 0);

vul cnta;
vul cntb;

void search(ul curr, ul dep, vul& cnt, ul prev)
{
	while (cnt.size() <= dep) {
		cnt.push_back(0);
	}
	++cnt[dep];
	for (ul nex : edges[curr]) {
		if (prev == nex) {
			continue;
		}
		search(nex, dep + 1, cnt, curr);
	}
}

using llf = long double;
using comp = std::complex<long double>;
const long double pi = std::acos((long double)(-1.0));

std::vector<std::vector<comp>> wsp(19);
std::vector<std::vector<comp>> wsn(19);

void fft(comp* p, ul n, int oper)
{
	for (ul i = 0, j = 0; i != n; ++i) {
		if (i < j) {
			std::swap(p[i], p[j]);
		}
		ul k = n >> 1;
		while (k & j) {
			j &= ~k;
			k >>= 1;
		}
		j |= k;
	}
	comp t;
	for (ul d = 0; (1 << d) < n; ++d) {
		ul m = 1 << d;
		ul m2 = m << 1;
		if (wsp[d].empty() || wsn[d].empty()) {
			wsp[d].resize(m);
			wsn[d].resize(m);
			for (ul i = 0; i != m; ++i) {
				wsp[d][i] = comp(std::cos(pi / llf(m) * llf(i)), std::sin(pi / llf(m) * llf(i)));
				wsn[d][i] = comp(std::cos(-pi / llf(m) * llf(i)), std::sin(-pi / llf(m) * llf(i)));
			}
		}
		for (ul i = 0; i != n; i += m2) {
			for (ul j = 0; j != m; ++j) {
				comp &p1 = p[i + j + m], &p2 = p[i + j];
				t = (oper > 0 ? wsp[d][j] : wsn[d][j]) * p1;
				p1 = p2 - t;
				p2 = p2 + t;
			}
		}
	}
	if (oper < 0) {
		llf a = llf(1) / llf(n);
		for (ul i = 0; i != n; ++i) {
			p[i] = p[i] * a;
		}
	}
}

comp pa[sz];
comp pb[sz];

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	rands.seed(std::time(0));
	std::cin >> n;
	for (ul i = 1; i != n; ++i) {
		ul u, v;
		std::cin >> u >> v;
		edges[u].insert(v);
		edges[v].insert(u);
		edgs[i].first = u;
		edgs[i].second = v;
		change(1, i);
	}
	while (tree[1]) {
		ul x = query(rand() % tree[1]);
		change(0, x);
		ul a = edgs[x].first;
		ul b = edgs[x].second;
		edges[a].erase(b);
		edges[b].erase(a);
		cnta.resize(0);
		cntb.resize(0);
		search(a, 0, cnta, 0);
		search(b, 0, cntb, 0);
		ul tn = 1;
		while (tn < cnta.size() - 1 + cntb.size() - 1 + 1) {
			tn = tn << 1;
		}
		for (ul i = 0; i != cnta.size(); ++i) {
			pa[i] = cnta[i];
		}
		for (ul i = cnta.size(); i != tn; ++i) {
			pa[i] = 0;
		}
		for (ul i = 0; i != cntb.size(); ++i) {
			pb[i] = cntb[i];
		}
		for (ul i = cntb.size(); i != tn; ++i) {
			pb[i] = 0;
		}
		fft(pa, tn, 1);
		fft(pb, tn, 1);
		for (ul i = 0; i != tn; ++i) {
			pa[i] *= pb[i];
		}
		fft(pa, tn, -1);
		for (ul i = 0; i != tn && i + 1 < 2e5; ++i) {
			ans[i + 1] += llround(pa[i].real());
		}
	}
	ull out = 0;
	for (ul i = 1; i != 2e5; ++i) {
		out += ull(i + 1 >> 1) * ans[i];
	}
	std::cout << out << std::endl;
	return 0;
}


#include <iostream>
#include <ios>
#include <cstdint>
#include <vector>
#include <string>
#include <random>
#include <utility>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <set>
#include <complex>

using ul = std::uint32_t;
using li = std::int32_t;
using ull = std::uint64_t;
using ll = std::int64_t;
using vul = std::vector<ul>;
using vvul = std::vector<vul>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;
using vvvb = std::vector<vvb>;
using vull = std::vector<ull>;
using vli = std::vector<li>;
using vll = std::vector<ll>;
using pulul = std::pair<ul, ul>;
using vpulul = std::vector<pulul>;

const ul sz = 1 << 18;
std::mt19937 rands;

ul n;
std::vector<std::set<ul>> edges(2e5 + 1);

vul tree(sz << 1, 0);

void change(ul v, ul pos)
{
	for (tree[pos |= sz] = v, pos >>= 1; pos; pos >>= 1) {
		tree[pos] = tree[pos << 1] + tree[pos << 1 | 1];
	}
}

ul query(ul x)
{
	ul pos = 1;
	for ( ; pos < sz; ) {
		if (x < tree[pos << 1]) {
			pos = pos << 1;
		} else {
			pos = pos << 1 | 1;
			x -= tree[pos ^ 1];
		}
	}
	return pos & ~sz;
}

vpulul edgs(2e5);

vull ans(2e5, 0);

vul cnta;
vul cntb;

void search(ul curr, ul dep, vul& cnt, ul prev)
{
	while (cnt.size() <= dep) {
		cnt.push_back(0);
	}
	++cnt[dep];
	for (ul nex : edges[curr]) {
		if (prev == nex) {
			continue;
		}
		search(nex, dep + 1, cnt, curr);
	}
}

using llf = double;
using comp = std::complex<llf>;
const llf pi = std::acos((llf)(-1.0));

std::vector<std::vector<comp>> wsp(19);
std::vector<std::vector<comp>> wsn(19);

void fft(comp* p, ul n, int oper)
{
	for (ul i = 0, j = 0; i != n; ++i) {
		if (i < j) {
			std::swap(p[i], p[j]);
		}
		ul k = n >> 1;
		while (k & j) {
			j &= ~k;
			k >>= 1;
		}
		j |= k;
	}
	comp t;
	for (ul d = 0; (1 << d) < n; ++d) {
		ul m = 1 << d;
		ul m2 = m << 1;
		if (wsp[d].empty() || wsn[d].empty()) {
			wsp[d].resize(m);
			wsn[d].resize(m);
			for (ul i = 0; i != m; ++i) {
				wsp[d][i] = comp(std::cos(pi / llf(m) * llf(i)), std::sin(pi / llf(m) * llf(i)));
				wsn[d][i] = comp(std::cos(-pi / llf(m) * llf(i)), std::sin(-pi / llf(m) * llf(i)));
			}
		}
		for (ul i = 0; i != n; i += m2) {
			for (ul j = 0; j != m; ++j) {
				comp &p1 = p[i + j + m], &p2 = p[i + j];
				t = (oper > 0 ? wsp[d][j] : wsn[d][j]) * p1;
				p1 = p2 - t;
				p2 = p2 + t;
			}
		}
	}
	if (oper < 0) {
		llf a = llf(1) / llf(n);
		for (ul i = 0; i != n; ++i) {
			p[i] = p[i] * a;
		}
	}
}

comp pa[sz];
comp pb[sz];

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	rands.seed(std::time(0));
	std::cin >> n;
	for (ul i = 1; i != n; ++i) {
		ul u, v;
		std::cin >> u >> v;
		edges[u].insert(v);
		edges[v].insert(u);
		edgs[i].first = u;
		edgs[i].second = v;
		change(1, i);
	}
	while (tree[1]) {
		ul x = query(rand() % tree[1]);
		change(0, x);
		ul a = edgs[x].first;
		ul b = edgs[x].second;
		edges[a].erase(b);
		edges[b].erase(a);
		cnta.resize(0);
		cntb.resize(0);
		search(a, 0, cnta, 0);
		search(b, 0, cntb, 0);
		ul tn = 1;
		while (tn < cnta.size() - 1 + cntb.size() - 1 + 1) {
			tn = tn << 1;
		}
		for (ul i = 0; i != cnta.size(); ++i) {
			pa[i] = cnta[i];
		}
		for (ul i = cnta.size(); i != tn; ++i) {
			pa[i] = 0;
		}
		for (ul i = 0; i != cntb.size(); ++i) {
			pb[i] = cntb[i];
		}
		for (ul i = cntb.size(); i != tn; ++i) {
			pb[i] = 0;
		}
		fft(pa, tn, 1);
		fft(pb, tn, 1);
		for (ul i = 0; i != tn; ++i) {
			pa[i] *= pb[i];
		}
		fft(pa, tn, -1);
		for (ul i = 0; i != tn && i + 1 < 2e5; ++i) {
			ans[i + 1] += llround(pa[i].real());
		}
	}
	ull out = 0;
	for (ul i = 1; i != 2e5; ++i) {
		out += ull(i + 1 >> 1) * ans[i];
	}
	std::cout << out << std::endl;
	return 0;
}


#include <iostream>
#include <ios>
#include <cstdint>
#include <vector>
#include <string>
#include <random>
#include <utility>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <set>
#include <complex>

using ul = std::uint32_t;
using li = std::int32_t;
using ull = std::uint64_t;
using ll = std::int64_t;
using vul = std::vector<ul>;
using vvul = std::vector<vul>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;
using vvvb = std::vector<vvb>;
using vull = std::vector<ull>;
using vli = std::vector<li>;
using vll = std::vector<ll>;
using pulul = std::pair<ul, ul>;
using vpulul = std::vector<pulul>;

const ul sz = 1 << 18;
std::mt19937 rands;

ul n;
std::vector<std::set<ul>> edges(2e5 + 1);

vvul cnt(2, vul(sz, 0));
ull ans = 0;

void search(ul curr, ul prev, ul dep)
{
	for (ul nex : edges[curr]) {
		if (nex == prev) {
			continue;
		}
		search(nex, curr, dep ^ 1);
		cnt[0][curr] += cnt[0][nex];
		cnt[1][curr] += cnt[1][nex];
	}
	cnt[dep][curr] += 1;
}

void getans(ul curr, ul prev)
{
	for (ul nex : edges[curr]) {
		if (nex == prev) {
			continue;
		}
		ans += ull(cnt[0][nex] + cnt[1][nex]) * ull(cnt[0][1] + cnt[1][1] - cnt[0][nex] - cnt[1][nex]);
		getans(nex, curr);
	}
}

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	rands.seed(std::time(0));
	std::cin >> n;
	for (ul i = 1; i != n; ++i) {
		ul u, v;
		std::cin >> u >> v;
		edges[u].insert(v);
		edges[v].insert(u);
	}
	search(1, 0, 0);
	getans(1, 0);
	ans += ull(cnt[0][1]) * ull(cnt[1][1]);
	std::cout << (ans >> 1) << std::endl;
	return 0;
}


#include "bits/stdc++.h"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
const int maxn = 234567;
vector<int> e[maxn];
int par[maxn], sz[maxn], dep[maxn];
long long d[maxn];
void dfs(int s){
	sz[s] = 1;
	for(int n : e[s]){
		if(n == par[s]) continue;
		par[n] = s;
		dep[n] = dep[s] + 1;
		dfs(n);
		d[s] += d[n] + sz[n];
		sz[s] += sz[n];
	}
}
int bn;
void fix(int s){
	if(par[s]){
		long long uv = d[par[s]] - d[s] - sz[s];
		d[s] += uv + bn - sz[s];
	}
	for(int n : e[s]){
		if(n == par[s]) continue;
		fix(n);
	}
}
long long r = 0;
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n - 1; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	dfs(1);
	bn = n;
	fix(1);
	for(int i = 1; i <= n; i++) d[i] -= (n - 1 - e[i].size());
	for(int i = 1; i <= n; i++) r += d[i];
	cout << r/2. << endl;
	return 0;
}


#include "bits/stdc++.h"
using namespace std;
const int maxn = 234567;
vector<int> e[maxn];
int on[maxn], sz[maxn];
long long r = 0;
void df(int s, int c){
	sz[s] = 1;
	for(int n : e[s]) if(n != c && !on[n]){
		df(n, s);
		sz[s] += sz[n];
	}
}
int gg(int s, int c, int uu){
	int im = 0;
	for(int n : e[s]) if(n != c && !on[n]){
		if(im == 0) im = n;
		else if(sz[n] > sz[im]) im = n;
	}
	if(im == 0 || sz[im] <= uu/2) return im;
	return gg(im, s, uu);
}
void cmpa(int s, int c, int d, long long aa[]){
	if(d%2 == 1){
		r += (d/2 + 1)*aa[2] + aa[0]/2;
		r += (d/2 + 1)*aa[3] + aa[1]/2;
	} else {
		r += (d/2)*aa[2] + aa[0]/2;
		r += (d/2 + 1)*aa[3] + aa[1]/2;
	}
	for(int n : e[s]) if(n != c && !on[n]) cmpa(n, s, d + 1, aa);
}
void cmpb(int s, int c, int d, long long aa[]){
	aa[(d%2)] += d;
	aa[2+(d%2)] += 1;
	for(int n : e[s]) if(n != c && !on[n]) cmpb(n, s, d + 1, aa);
}
void cmp(int s, int c){
	long long cc[4] = {};
	cc[2] = 1;
	for(int n : e[s]) if(n != c && !on[n]){
		cmpa(n, s, 1, cc);
		cmpb(n, s, 1, cc);
	}
}
void fu(int s){
	df(s, 0);
	int x = gg(s, 0, sz[s]);
	cmp(x, 0);
	on[x] = 1;
	for(int n : e[s]) if(!on[n]) fu(n);
}
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n - 1; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	fu(1);
	cout << r << endl;
	return 0;
}


#include "bits/stdc++.h"
using namespace std;
const int maxn = 234567;
vector<int> e[maxn];
int on[maxn], sz[maxn];
long long r = 0;
void df(int s, int c){
	sz[s] = 1;
	for(int n : e[s]) if(n != c && !on[n]){
		df(n, s);
		sz[s] += sz[n];
	}
}
int gg(int s, int c, int uu){
	int im = 0;
	for(int n : e[s]) if(n != c && !on[n]){
		if(im == 0) im = n;
		else if(sz[n] > sz[im]) im = n;
	}
	if(im == 0 || sz[im] <= uu/2) return s;
	return gg(im, s, uu);
}
void cmpa(int s, int c, int d, long long aa[]){
	if(d%2 == 1){
		r += (d/2 + 1)*aa[2] + aa[0]/2;
		r += (d/2 + 1)*aa[3] + aa[1]/2;
	} else {
		r += (d/2)*aa[2] + aa[0]/2;
		r += (d/2 + 1)*aa[3] + aa[1]/2;
	}
	for(int n : e[s]) if(n != c && !on[n]) cmpa(n, s, d + 1, aa);
}
void cmpb(int s, int c, int d, long long aa[]){
	aa[(d%2)] += d;
	aa[2+(d%2)] += 1;
	for(int n : e[s]) if(n != c && !on[n]) cmpb(n, s, d + 1, aa);
}
void cmp(int s, int c){
	long long cc[4] = {};
	cc[2] = 1;
	for(int n : e[s]) if(n != c && !on[n]){
		cmpa(n, s, 1, cc);
		cmpb(n, s, 1, cc);
	}
}
void fu(int s){
	df(s, 0);
	int x = gg(s, 0, sz[s]);
	cmp(x, 0);
	on[x] = 1;
	for(int n : e[s]) if(!on[n]) fu(n);
}
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n - 1; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	fu(1);
	cout << r << endl;
	return 0;
}


#include "bits/stdc++.h"
using namespace std;
const int maxn = 234567;
vector<int> e[maxn];
int on[maxn], sz[maxn];
long long r = 0;
void df(int s, int c){
	sz[s] = 1;
	for(int n : e[s]) if(n != c && !on[n]){
		df(n, s);
		sz[s] += sz[n];
	}
}
int gg(int s, int c, int uu){
	int im = 0;
	for(int n : e[s]) if(n != c && !on[n]){
		if(im == 0) im = n;
		else if(sz[n] > sz[im]) im = n;
	}
	if(im == 0 || sz[im] <= uu/2) return s;
	return gg(im, s, uu);
}
void cmpa(int s, int c, int d, long long aa[]){
	if(d%2 == 1){
		r += (d/2 + 1)*aa[2] + aa[0]/2;
		r += (d/2 + 1)*aa[3] + (aa[1] - aa[3])/2;
	} else {
		r += (d/2)*aa[2] + aa[0]/2;
		r += (d/2 + 1)*aa[3] + (aa[1] - aa[3])/2;
	}
	for(int n : e[s]) if(n != c && !on[n]) cmpa(n, s, d + 1, aa);
}
void cmpb(int s, int c, int d, long long aa[]){
	aa[(d%2)] += d;
	aa[2+(d%2)] += 1;
	for(int n : e[s]) if(n != c && !on[n]) cmpb(n, s, d + 1, aa);
}
void cmp(int s, int c){
	long long cc[4] = {};
	cc[2] = 1;
	for(int n : e[s]) if(n != c && !on[n]){
		cmpa(n, s, 1, cc);
		cmpb(n, s, 1, cc);
	}
}
void fu(int s){
	df(s, 0);
	int x = gg(s, 0, sz[s]);
	cmp(x, 0);
	// cout << x << endl;
	on[x] = 1;
	for(int n : e[x]) if(!on[n]) fu(n);
}
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n - 1; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	fu(1);
	cout << r << endl;
	return 0;
}


#include "bits/stdc++.h"
using namespace std;
const int maxn = 234567;
vector<int> e[maxn];
int par[maxn], sz[maxn], dep[maxn];
long long d[maxn];
void dfs(int s){
	sz[s] = 1;
	for(int n : e[s]){
		if(n == par[s]) continue;
		par[n] = s;
		dep[n] = dep[s] + 1;
		dfs(n);
		d[s] += d[n] + sz[n];
		sz[s] += sz[n];
	}
}
int bn;
void fix(int s){
	if(par[s]){
		long long uv = d[par[s]] - d[s] - sz[s];
		d[s] += uv + bn - sz[s];
	}
	for(int n : e[s]){
		if(n == par[s]) continue;
		fix(n);
	}
}
long long r = 0;
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n - 1; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	dfs(1);
	bn = n;
	fix(1);
	for(int i = 1; i <= n; i++) d[i] -= (n - 1 - e[i].size());
	for(int i = 1; i <= n; i++) r += d[i];
	assert(r%2 == 0);
	cout << r/2 << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define fio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

const int N = 2e5+5;
vector<int> T[N];
int n;
int sze[N];
int szo[N];
int sdre[N];
int sdro[N];

void ssz(int v, int p) {
	sze[v] = 1;
	szo[v] = 0;
	for(int u : T[v]) {
		if(u == p)
			continue;
		ssz(u, v);
		szo[v] += sze[u];
		sze[v] += szo[u];
	}
}

void ssdr(int v, int p) {
	sdre[v] = 0;
	sdro[v] = 0;
	for(int u : T[v]) {
		if(u == p)
			continue;
		ssdr(u, v);
		sdre[v] += sdro[u] + (szo[u]);
		sdro[v] += sdre[u] + (sze[u]);
	}
}

ll dfs(int u, int p, ll se, ll so, int ne, int no) {
	ll ans = 0;
	ans += se/2;
	ans += (so-no)/2 + no;
	ne += 1;
	for(int v : T[u]) {
		if(v == p) continue;
		ans += dfs(v, u, so + no, se + ne, no, ne);
		se += sdro[v] + szo[v];
		so += sdre[v] + sze[v];
		ne += szo[v];
		no += sze[v];
	}
	return ans;
}

int main() {
	fio;
	cin >> n;
	for(int i = 1; i < n; ++i) {
		int u, v;
		cin >> u >> v;
		T[u].push_back(v);
		T[v].push_back(u);
	}
	ssz(1, 0);
	ssdr(1, 0);
	cout << dfs(1, 0, 0, 0, 0, 0) << "\n";
}


#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define fio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

const int N = 2e5+5;
vector<int> T[N];
int n;
int sze[N];
int szo[N];
ll sdre[N];
ll sdro[N];

void ssz(int v, int p) {
	sze[v] = 1;
	szo[v] = 0;
	for(int u : T[v]) {
		if(u == p)
			continue;
		ssz(u, v);
		szo[v] += sze[u];
		sze[v] += szo[u];
	}
}

void ssdr(int v, int p) {
	sdre[v] = 0;
	sdro[v] = 0;
	for(int u : T[v]) {
		if(u == p)
			continue;
		ssdr(u, v);
		sdre[v] += sdro[u] + (szo[u]);
		sdro[v] += sdre[u] + (sze[u]);
	}
}

ll dfs(int u, int p, ll se, ll so, int ne, int no) {
	ll ans = 0;
	ans += se/2;
	ans += (so-no)/2 + no;
	ne += 1;
	for(int v : T[u]) {
		if(v == p) continue;
		ans += dfs(v, u, so + no, se + ne, no, ne);
		se += sdro[v] + szo[v];
		so += sdre[v] + sze[v];
		ne += szo[v];
		no += sze[v];
	}
	return ans;
}

int main() {
	fio;
	cin >> n;
	for(int i = 1; i < n; ++i) {
		int u, v;
		cin >> u >> v;
		T[u].push_back(v);
		T[v].push_back(u);
	}
	ssz(1, 0);
	ssdr(1, 0);
	cout << dfs(1, 0, 0, 0, 0, 0) << "\n";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

const int N = 1e5+5;
vector<int> T[N];

int sz[N];
ll odd = 0, ans = 0;
int n;

ll dfs(int v, int p, bool o) {
	if(o) ++odd;
	sz[v] = 1;
	ll to_root = 0;
	for(int u : T[v]) {
		if(u == p) continue;
		ll tru = dfs(u, v, !o) + sz[u];
		ans += to_root *  sz[u] + sz[v] * tru;
		to_root += tru;
		sz[v] += sz[u];
	}
	return to_root;
}

int main() {
	fio;
	cin >> n;
	for(int i = 1; i < n; ++i) {
		int u, v;
		cin >> u >> v;
		T[u].push_back(v);
		T[v].push_back(u);
	}
	dfs(1, 0, 0);
	cout << (ans + odd * (n-odd))/2 << "\n";
}


#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define fio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

const int N = 2e5+5;
vector<int> T[N];
int n;
int sze[N];
int szo[N];
int sdre[N];
int sdro[N];

void ssz(int v, int p) {
	sze[v] = 1;
	szo[v] = 0;
	for(int u : T[v]) {
		if(u == p)
			continue;
		ssz(u, v);
		szo[v] += sze[u];
		sze[v] += szo[u];
	}
}

void ssdr(int v, int p) {
	sdre[v] = 0;
	sdro[v] = 0;
	for(int u : T[v]) {
		if(u == p)
			continue;
		ssdr(u, v);
		sdre[v] += sdro[u] + (szo[u]);
		sdro[v] += sdre[u] + (sze[u]);
	}
}

ll dfs(int u, int p, int se, int so, int ne, int no) {
	ll ans = 0;
	ans += se/2;
	ans += (so-no)/2 + no;
	ne += 1;
	for(int v : T[u]) {
		if(v == p) continue;
		ans += dfs(v, u, so + no, se + ne, no, ne);
		se += sdro[v] + szo[v];
		so += sdre[v] + sze[v];
		ne += szo[v];
		no += sze[v];
	}
	return ans;
}

int main() {
	fio;
	cin >> n;
	for(int i = 1; i < n; ++i) {
		int u, v;
		cin >> u >> v;
		T[u].push_back(v);
		T[v].push_back(u);
	}
	ssz(1, 0);
	ssdr(1, 0);
	cout << dfs(1, 0, 0, 0, 0, 0) << "\n";
}


#include<bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN=1e5+5;
vector<int> E[MAXN];
int szD[MAXN][2],szU[MAXN][2];
ll disD[MAXN],disU[MAXN],ans;
void dfs1(int now,int fa=0)
{
	szD[now][0]=1;
	disD[now]=0;
	for(int i=0;i<E[now].size();i++)
	{
		int v=E[now][i];
		if(v==fa) continue;
		dfs1(v,now);
		szD[now][0]+=szD[v][1];szD[now][1]+=szD[v][0];
		disD[now]+=disD[v]+szD[v][1];
	}
}
void dfs2(int now,int fa=0)
{
	if(fa==0)
		szU[now][0]=1;
	else
	{
		szU[now][0]=1+szU[fa][1]+szD[fa][1]-szD[now][0];
		szU[now][1]=szU[fa][0]+szD[fa][0]-szD[now][1]-1;
	}
	if(fa!=0)
		disU[now]=disU[fa]+szU[now][1]+disD[fa]-disD[now]-szD[now][1];
	ans+=disU[now];
	for(int i=0;i<E[now].size();i++)
	{
		int v=E[now][i];
		if(v==fa) continue;
		dfs2(v,now);
	}
}
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		E[u].pb(v);E[v].pb(u);
	}
	ans=0;
	dfs1(1);dfs2(1);
	printf("%lld\n",ans);
	return 0;
}


#include<bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN=2e5+5;
vector<int> E[MAXN];
int szD[MAXN][2],szU[MAXN][2];
ll disD[MAXN],disU[MAXN],ans;
void dfs1(int now,int fa=0)
{
	if(fa==0)
		szU[now][0]=1;
	else
	{
		szU[now][0]=1+szU[fa][1]+szD[fa][1];
		szU[now][1]=szU[fa][0]+szD[fa][0]-1;
	}
	if(fa!=0) disU[now]=disU[fa]+szU[now][1]+disD[fa];
	ans+=disU[now];
	szD[now][0]=1;
	disD[now]=0;
	for(int i=0;i<E[now].size();i++)
	{
		int v=E[now][i];
		if(v==fa) continue;
		dfs1(v,now);
		szD[now][0]+=szD[v][1];szD[now][1]+=szD[v][0];
		disD[now]+=disD[v]+szD[v][0];
	}
}
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		E[u].pb(v);E[v].pb(u);
	}
	ans=0;
	dfs1(1);
	printf("%lld\n",ans);
	return 0;
}


#include<bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN=1e5+5;
vector<int> E[MAXN];
int szD[MAXN][2],szU[MAXN][2];
ll disD[MAXN],disU[MAXN],ans;
void dfs1(int now,int fa=0)
{
	if(fa==0)
		szU[now][0]=1;
	else
	{
		szU[now][0]=1+szU[fa][1]+szD[fa][1];
		szU[now][1]=szU[fa][0]+szD[fa][0]-1;
	}
	if(fa!=0) disU[now]=disU[fa]+szU[now][1]+disD[fa];
	ans+=disU[now];
	szD[now][0]=1;
	disD[now]=0;
	for(int i=0;i<E[now].size();i++)
	{
		int v=E[now][i];
		if(v==fa) continue;
		dfs1(v,now);
		szD[now][0]+=szD[v][1];szD[now][1]+=szD[v][0];
		disD[now]+=disD[v]+szD[v][0];
	}
}
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		E[u].pb(v);E[v].pb(u);
	}
	ans=0;
	dfs1(1);
	printf("%lld\n",ans);
	return 0;
}


#include<bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN=1e5+5;
vector<int> E[MAXN];
int sz[MAXN];
ll dis[MAXN],ans;
void dfs(int now,int fa=0)
{
	sz[now]=1;
	dis[now]=0;
	for(auto v:E[now])
	{
		if(v==fa) continue;
		dfs(v,now);
		sz[now]+=sz[v];
		dis[now]+=dis[v]+sz[v];
		ans+=dis[v];
	}
	if(fa!=0)
	{
		ans+=dis[fa];
	}
	if(fa==0)
		ans+=E[now].size();
	else
		ans+=E[now].size()-1;
}
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		E[u].pb(v);E[v].pb(u);
	}
	ans=0;
	dfs(1);
	printf("%lld\n",ans);
	return 0;
}


#include<bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN=1e5+5;
vector<int> E[MAXN];
int sz[MAXN][2];
ll dis[MAXN],ans;
void dfs(int now,int fa=0,int flag=0)
{
	sz[now][flag]=1;
	dis[now]=0;
	for(auto v:E[now])
	{
		if(v==fa) continue;
		dfs(v,now,flag^1);
		sz[now][0]+=sz[v][0];sz[now][1]+=sz[v][1];
		dis[now]+=dis[v]+sz[v][flag^1];
	}
	ans+=dis[fa];
	ans+=dis[now];
}
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		E[u].pb(v);E[v].pb(u);
	}
	ans=0;
	dfs(1);
	printf("%lld\n",ans);
	return 0;
}


/*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second; return _out; }
template<typename T, typename U> inline istream &operator>> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const vector<T> &_v) { if (_v.empty()) { return _out; } _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline istream &operator>> (istream &_in, vector<T> &_v) { for (auto &_i : _v) { _in >> _i; } return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228
#define y1 y1228
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define x first
#define y second
const string FILENAME = "input";
const int MAXN = 200228;

int n;
vector<int> v[MAXN];
vector<int> g[MAXN];
int prs[MAXN];

void dfs(int u, int pr = -1) {
    for (auto x: v[u]) {
        if (x == pr) {
            continue;
        }
        g[u].pb(x);
        prs[x] = u;
        dfs(x, u);
    }
}

long long ans = 0;
int sz[MAXN];
long long down[MAXN];

void dfs1(int u) {
    long long cursum = 0;
    for (auto x: g[u]) {
        dfs1(x);
        ans -= 1LL * sz[u] * sz[x];
        sz[u] += sz[x];
    }
    sz[u]++;
}

void dfs2(int u) {
    int curcnt = 0;
    for (auto x: g[u]) {
        dfs2(x);
        ans += 1LL * sz[x] * down[u];
        ans += 1LL * curcnt * (down[x] + sz[x]);
        curcnt += sz[x];
        down[u] += down[x] + sz[x];
    }
    ans += down[u];
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //read(FILENAME);
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    prs[0] = -1;
    dfs(0);
    dfs1(0);
    for (int i = 0; i < n; i++) {
        for (auto x: g[i]) {
            if (prs[i] != -1) {
                ans -= (n - sz[prs[i]] + 1);
            }
        }
    }
    dfs2(0);
    cout << ans << '\n';
    return 0;
}


/*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second; return _out; }
template<typename T, typename U> inline istream &operator>> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const vector<T> &_v) { if (_v.empty()) { return _out; } _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline istream &operator>> (istream &_in, vector<T> &_v) { for (auto &_i : _v) { _in >> _i; } return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228
#define y1 y1228
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define x first
#define y second
const string FILENAME = "input";
const int MAXN = 200228;

int n;
vector<int> v[MAXN];
vector<int> g[MAXN];
int prs[MAXN];

void dfs(int u, int pr = -1) {
    for (auto x: v[u]) {
        if (x == pr) {
            continue;
        }
        g[u].pb(x);
        prs[x] = u;
        dfs(x, u);
    }
}

long long ans = 0;
int sz[MAXN];
long long down[MAXN];
int deep[MAXN];

void dfs1(int u) {
    long long cursum = 0;
    for (auto x: g[u]) {
        deep[x] = deep[u] + 1;
        dfs1(x);
        ans -= 1LL * sz[u] * sz[x];
        sz[u] += sz[x];
    }
    sz[u]++;
}

void dfs2(int u) {
    int curcnt = 0;
    for (auto x: g[u]) {
        dfs2(x);
        ans += 1LL * (down[x] + sz[x]) * (sz[u] - sz[x] - 1);
        down[u] += down[x] + sz[x];
    }
   // cout << down[u] << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //read(FILENAME);
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    prs[0] = -1;
    dfs(0);
    dfs1(0);
    for (int i = 0; i < n; i++) {
        int s = deep[i];
        if (s & 1) {
            ans += (s + 1) / 2;
            s--;
        }
        s /= 2;
        ans += 1LL * s * (s + 1);
    }
    dfs2(0);
    cout << ans << '\n';
    return 0;
}


/*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second; return _out; }
template<typename T, typename U> inline istream &operator>> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const vector<T> &_v) { if (_v.empty()) { return _out; } _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline istream &operator>> (istream &_in, vector<T> &_v) { for (auto &_i : _v) { _in >> _i; } return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228
#define y1 y1228
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define x first
#define y second
const string FILENAME = "input";
const int MAXN = 200228;

int n;
vector<int> v[MAXN];
vector<int> g[MAXN];
int prs[MAXN];

void dfs(int u, int pr = -1) {
    for (auto x: v[u]) {
        if (x == pr) {
            continue;
        }
        g[u].pb(x);
        prs[x] = u;
        dfs(x, u);
    }
}

long long ans = 0;
int sz[MAXN];
long long down[MAXN];
int deep[MAXN];
long long cnt[MAXN];
long long s = 0;

void dfs1(int u) {
    if (deep[u] & 1) {
        s++;
    }
    long long cursum = 0;
    for (auto x: g[u]) {
        deep[x] = deep[u] + 1;
        dfs1(x);
        sz[u] += sz[x];
    }
    sz[u]++;
    ans += 1LL * sz[u] * (n - sz[u]);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //read(FILENAME);
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    prs[0] = -1;
    dfs(0);
    dfs1(0);
    ans += s * (n - s);
    cout << ans / 2 << '\n';
    return 0;
}


/*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second; return _out; }
template<typename T, typename U> inline istream &operator>> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const vector<T> &_v) { if (_v.empty()) { return _out; } _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline istream &operator>> (istream &_in, vector<T> &_v) { for (auto &_i : _v) { _in >> _i; } return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228
#define y1 y1228
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define x first
#define y second
const string FILENAME = "input";
const int MAXN = 200228;

int n;
vector<int> v[MAXN];
vector<int> g[MAXN];
int prs[MAXN];

void dfs(int u, int pr = -1) {
    for (auto x: v[u]) {
        if (x == pr) {
            continue;
        }
        g[u].pb(x);
        prs[x] = u;
        dfs(x, u);
    }
}

long long ans = 0;
int sz[MAXN];
long long down[MAXN];
int deep[MAXN];
long long cnt[MAXN];
long long s = 0;

void dfs1(int u) {
    if (deep[u] & 1) {
        s++;
    }
    long long cursum = 0;
    for (auto x: g[u]) {
        deep[x] = deep[u] + 1;
        dfs1(x);
        sz[u] += sz[x];
    }
    sz[u]++;
    ans += sz[u] * (n - sz[u]);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //read(FILENAME);
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    prs[0] = -1;
    dfs(0);
    dfs1(0);
    ans += s * (n - s);
    cout << ans / 2 << '\n';
    return 0;
}


/*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second; return _out; }
template<typename T, typename U> inline istream &operator>> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const vector<T> &_v) { if (_v.empty()) { return _out; } _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline istream &operator>> (istream &_in, vector<T> &_v) { for (auto &_i : _v) { _in >> _i; } return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228
#define y1 y1228
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define x first
#define y second
const string FILENAME = "input";
const int MAXN = 200228;

int n;
vector<int> v[MAXN];
vector<int> g[MAXN];
int prs[MAXN];

void dfs(int u, int pr = -1) {
    for (auto x: v[u]) {
        if (x == pr) {
            continue;
        }
        g[u].pb(x);
        prs[x] = u;
        dfs(x, u);
    }
}

long long ans = 0;
int sz[MAXN];
long long down[MAXN];
int deep[MAXN];
long long cnt[MAXN];

void dfs1(int u) {
    long long cursum = 0;
    for (auto x: g[u]) {
        deep[x] = deep[u] + 1;
        dfs1(x);
        sz[u] += sz[x];
    }
    sz[u]++;
}

long long add[MAXN];

void dfs2(int u) {
    cnt[u]++;
    int curcnt = 0;
    for (auto x: g[u]) {
        dfs2(x);
        if (prs[u] != -1) {
            down[prs[u]] += down[x] + cnt[x];
            cnt[prs[u]] += cnt[x];
        }
        //cout << down[x] + add[x] << ' ' << x + 1 << endl;
        ans += 1LL * (down[x] + add[x]) * (sz[u] - sz[x] - 1);
        ans += 1LL * sz[x] * curcnt;
        curcnt += sz[x];
        add[u] += down[x] + cnt[x];
    }
   // cout << down[u] << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   // read(FILENAME);
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    prs[0] = -1;
    dfs(0);
    dfs1(0);
    for (int i = 0; i < n; i++) {
        int s = deep[i];
        if (s & 1) {
            ans += (s + 1) / 2;
            s--;
        }
        s /= 2;
        ans += 1LL * s * (s + 1);
    }
    dfs2(0);
    cout << ans << '\n';
    return 0;
}


/*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second; return _out; }
template<typename T, typename U> inline istream &operator>> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const vector<T> &_v) { if (_v.empty()) { return _out; } _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline istream &operator>> (istream &_in, vector<T> &_v) { for (auto &_i : _v) { _in >> _i; } return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228
#define y1 y1228
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define x first
#define y second
const string FILENAME = "input";
const int MAXN = 200228;

int n;
vector<int> v[MAXN];
vector<int> g[MAXN];
int prs[MAXN];

void dfs(int u, int pr = -1) {
    for (auto x: v[u]) {
        if (x == pr) {
            continue;
        }
        g[u].pb(x);
        prs[x] = u;
        dfs(x, u);
    }
}

long long ans = 0;
int sz[MAXN];
long long down[MAXN];
int deep[MAXN];

void dfs1(int u) {
    long long cursum = 0;
    for (auto x: g[u]) {
        deep[x] = deep[u] + 1;
        dfs1(x);
        ans -= 1LL * sz[u] * sz[x];
        sz[u] += sz[x];
    }
    sz[u]++;
}

void dfs2(int u) {
    int curcnt = 0;
    for (auto x: g[u]) {
        dfs2(x);
        ans += 1LL * sz[x] * down[u];
        ans += 1LL * curcnt * (down[x] + sz[x]);
        curcnt += sz[x];
        down[u] += down[x] + sz[x];
    }
   // cout << down[u] << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //read(FILENAME);
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    prs[0] = -1;
    dfs(0);
    dfs1(0);
   // cout << ans << endl;
    for (int i = 0; i < n; i++) {
        int s = deep[i];
        if (s & 1) {
            ans += (s + 1) / 2;
            s--;
        }
        s /= 2;
        ans += 1LL * s * (s + 1);
    }
    dfs2(0);
    cout << ans << '\n';
    return 0;
}


#include <iostream>
#include <stack>
#include <algorithm>
#include <string.h>
#include <queue>
#include <iomanip>
#include <map>
#include <cmath>
#include <set>
#include <climits>
#include <complex>
#define fi first
#define FI first
#define SE second.first
#define TH second.second
#define se second
using namespace std;
typedef long double ld;
//typedef complex<double> cd;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<vector<vector<ll>>> Matrix;
typedef pair<int, ii> iii;
const int maxN = 2e5 + 9, MOD = 1e9 + 7, LG = 11, BASE = 29;
const double EPS = 0;//49999937499086.022373199463

int n;
vector<int> adj[maxN];
ll sum[maxN], sz[maxN], ret = 0, norma[maxN];

void dfs(int nd, int an){
    sz[nd] = 1;
    for(int sn: adj[nd]){
        if(sn != an){
            dfs(sn, nd);
            sz[nd] += sz[sn];

            norma[nd] += norma[sn] + sz[sn];

            sum[nd] += sum[sn] + sz[sn] - int(adj[sn].size() - 1);
        }
    }
    ret += sum[nd];
}

void secon(int nd, int an, ll cnd){
    ret += cnd;

    for(int sn: adj[nd]){
        if(sn != an){
            secon(sn, nd, cnd);
            cnd += norma[sn] + sz[sn];
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> n;

    for(int u, v, i = 1; i < n; i++){
        cin >> u >> v;
        u--, v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    dfs(0, -1);

    secon(0, -1, 0);

    cout << ret << '\n';

}


#include <iostream>
#include <vector>
#include <string.h>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <sstream>
#include <stack>
#include <iomanip>
#include <cmath>
#include <climits>
#include <complex>
#include <cmath>
#define fi first
#define se second
#define th second

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef long double ld;
typedef complex<double> cd;

const int maxN = 2e5 + 9, MOD = 1e9 + 7;

int n, sz[maxN];
bool dead[maxN];
ll totLen = 0, totImp = 0, acum[maxN], pri[maxN][2];

vector<int> adj[maxN];

void preca(int nd, int an){
    sz[nd] = 1;
    acum[nd] = 0;
    pri[nd][0] = 1;
    pri[nd][1] = 0;
    for(int sn: adj[nd]){
        if(sn != an && !dead[sn]){
            preca(sn, nd);
            sz[nd] += sz[sn];
            acum[nd] += acum[sn] + sz[sn];
            pri[nd][0] += pri[sn][1];
            pri[nd][1] += pri[sn][0];
        }
    }
}

int getCent(int nd, int an, int totsz){
    for(int sn: adj[nd])
        if(sn != an && !dead[sn] && sz[sn] * 2 > totsz)
            return getCent(sn, nd, totsz);
    return nd;
}

void bruteForce(int nd){
    ll acuAc = 0, acuPar[2], cuenta = 1;
    acuPar[0] = 1;
    acuPar[1] = 0;
    //cout << nd << '\n';

    for(int sn: adj[nd]){
        if(!dead[sn]){

            ll currentAcu = acum[sn] + sz[sn];
            //cout << "look " << sn + 1 << ' ' << acum[sn] << ' ' << sz[sn] << ' ' << acuAc << '\n';

            totLen += ll(sz[sn]) * acuAc + currentAcu * cuenta;

            cuenta += sz[sn];
            acuAc += currentAcu;

            totImp += acuPar[0] * pri[sn][0];
            totImp += acuPar[1] * pri[sn][1];

            acuPar[0] += pri[sn][1];
            acuPar[1] += pri[sn][0];

        }
    }
}
/*

     2

 1      3

           4

 */

void solve(int nd){
    preca(nd, -1);
    nd = getCent(nd, -1, sz[nd]);

    preca(nd, -1);

    bruteForce(nd);

    dead[nd] = 1;

    for(int sn: adj[nd])
        if(!dead[sn])
            solve(sn);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> n;

    for(int u, v, i = 1; i < n; i++){
        cin >> u >> v, u--, v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    solve(0);

    //cout << totLen << ' ' << totImp << '\n';

    cout << (totLen + totImp) / 2 << '\n';

}


#include <iostream>
#include <stack>
#include <algorithm>
#include <string.h>
#include <queue>
#include <iomanip>
#include <map>
#include <cmath>
#include <set>
#include <climits>
#include <complex>
#define fi first
#define FI first
#define SE second.first
#define TH second.second
#define se second
using namespace std;
typedef long double ld;
//typedef complex<double> cd;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<vector<vector<ll>>> Matrix;
typedef pair<int, ii> iii;
const int maxN = 2e5 + 9, MOD = 1e9 + 7, LG = 11, BASE = 29;
const double EPS = 0;//49999937499086.022373199463

int n;
vector<int> adj[maxN];
ll sum[maxN], sz[maxN], ret = 0, norma[maxN];

void dfs(int nd, int an){
    sz[nd] = 1;
    for(int sn: adj[nd]){
        if(sn != an){
            dfs(sn, nd);
            sz[nd] += sz[sn];

            norma[nd] += norma[sn] + sz[sn];

            sum[nd] += sum[sn] + sz[sn] - int(adj[sn].size() - 1);
        }
    }
    ret += sum[nd];
}

void secon(int nd, int an, ll cnd, ll consi){
    ret += cnd;

    cnd += consi;

    for(int sn: adj[nd]){
        if(sn != an){
            secon(sn, nd, cnd, consi);
            consi += sz[sn];
            cnd += norma[sn] + sz[sn];
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> n;

    for(int u, v, i = 1; i < n; i++){
        cin >> u >> v;
        u--, v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    dfs(0, -1);

    secon(0, -1, 0, 0);

    cout << ret << '\n';

}


#include <iostream>
#include <stack>
#include <algorithm>
#include <string.h>
#include <queue>
#include <iomanip>
#include <map>
#include <cmath>
#include <set>
#include <climits>
#include <complex>
#define fi first
#define FI first
#define SE second.first
#define TH second.second
#define se second
using namespace std;
typedef long double ld;
//typedef complex<double> cd;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<vector<vector<ll>>> Matrix;
typedef pair<int, ii> iii;
const int maxN = 2e5 + 9, MOD = 1e9 + 7, LG = 11, BASE = 29;
const double EPS = 0;//49999937499086.022373199463

int n;
vector<int> adj[maxN];
ll sum[maxN], sz[maxN], ret = 0, norma[maxN];

void dfs(int nd, int an){
    sz[nd] = 1;
    for(int sn: adj[nd]){
        if(sn != an){
            dfs(sn, nd);
            sz[nd] += sz[sn];

            norma[nd] += norma[sn] + sz[sn];

            sum[nd] += sum[sn] + sz[sn] - int(adj[sn].size() - 1);
        }
    }
    ret += sum[nd];
}

void secon(int nd, int an){
    ll cnd = 0, amo = 0;
    for(int sn: adj[nd]){
        if(sn != an){
            secon(sn, nd);

            ret += cnd * sz[sn] + norma[sn] * amo;

            cnd += norma[sn] + sz[sn];
            amo += sz[sn];
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> n;

    for(int u, v, i = 1; i < n; i++){
        cin >> u >> v;
        u--, v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    dfs(0, -1);

    secon(0, -1);

    cout << ret << '\n';

}


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

using ii = pair<int,int>;
using ll = long long;

const int N = 2e5+5;
const int mod = 1e9 + 7;

ll tot, odd;
ll sv[N];
ll lvl[N];
int cnt[2];
vector<int>adj[N];
int n;
void dfs(int u, int p){

    sv[u] = 1;
    cnt[lvl[u]&1]++;

    for(auto v : adj[u])if(v != p){
        lvl[v] = lvl[u] + 1;
        dfs(v,u);
        sv[u]+= sv[v];
    }

    tot += (sv[u]*(n - sv[u]));

}

int main(){
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE

    cin >> n;

    for(int i = 0; i < n - 1; i++){
        int u,  v;  cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    dfs(1,1);
    odd = (cnt[0] * 1ll * cnt[1]) ;
    cout << (tot - odd) / 2 + odd << '\n';

    return 0;
}


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

using ii = pair<int,int>;
using ll = long long;

const int N = 2e5+5;
const int mod = 1e9 + 7;

ll tot, odd;
ll sv[N];
ll lvl[N];
ll dp[N][2];
vector<int>adj[N];
int n;
void dfs(int u, int p){

    sv[u] = 1;

    for(auto v : adj[u])if(v != p){
        lvl[v] = lvl[u] + 1;
        dfs(v,u);
        sv[u]+= sv[v];
        dp[u][0]+= dp[v][0];
        dp[u][1]+= dp[v][1];
    }

    tot += (sv[u]*(n - sv[u]));

    for(auto v : adj[u])if(v != p){
        odd += (dp[u][0] - dp[v][0]) * dp[v][1];
    }

    dp[u][lvl[u]&1]++;
    odd+= (dp[u][lvl[u]&1^1]);

}

int main(){
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE

    cin >> n;

    for(int i = 0; i < n - 1; i++){
        int u,  v;  cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    dfs(1,1);

    cout << (tot - odd) / 2 + odd << '\n';

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = 2e5 + 5;

vector<int>adj[N];
ll lvl[N], sz[N], n;
ll ans = 0, cnt[2];

void dfs(int u, int p){

  //cout << u << endl;
  sz[u] = 1;

  cnt[lvl[u] & 1]++;

  for(auto v : adj[u]){

    if(v == p)continue;
    lvl[v] = lvl[u] + 1;
    dfs(v, u);
    sz[u] += sz[v];
  }

  ll cur = 1ll * sz[u] * sz[u];

  for(auto v : adj[u]){
    if(v == p)continue;
    cur -= 1ll * sz[v] * sz[v];
  }
  //cout << cur << endl;
  ans += lvl[u] * (n - cur);

}

int main(){

  scanf("%d", &n);
  int u, v;

  for(int i = 0; i < n - 1; i++){

    scanf("%d%d", &u, &v);
    adj[u - 1].push_back(v - 1);
    adj[v - 1].push_back(u - 1);

  }

  dfs(0, -1);

  ans += (cnt[0] * cnt[1]);

  cout << ans/2 << '\n';

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = 1e5 + 5;

vector<int>adj[N];
ll lvl[N], sz[N], n;
ll ans = 0, cnt[2];

void dfs(int u, int p){

  //cout << u << endl;
  sz[u] = 1;

  cnt[lvl[u] & 1]++;

  for(auto v : adj[u]){

    if(v == p)continue;
    lvl[v] = lvl[u] + 1;
    dfs(v, u);
    sz[u] += sz[v];
  }

  ll cur = 1ll * sz[u] * sz[u];

  for(auto v : adj[u]){
    if(v == p)continue;
    cur -= 1ll * sz[v] * sz[v];
  }
  //cout << cur << endl;
  ans += lvl[u] * (n - cur);

}

int main(){

  scanf("%d", &n);
  int u, v;

  for(int i = 0; i < n - 1; i++){

    scanf("%d%d", &u, &v);
    adj[u - 1].push_back(v - 1);
    adj[v - 1].push_back(u - 1);

  }

  dfs(0, -1);

  ans += (cnt[0] * cnt[1]);

  cout << ans/2 << '\n';

}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:167772160000")
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <climits>
#include <set>
#include <bitset>
#include <math.h>
#include <queue>
#include <map>
#include <sstream>
#include <functional>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <regex>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::pair<double, double> pdd;
template <typename T> using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <typename T> using max_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;

#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define TESTS(t) int NUMBER_OF_TESTS; cin >> NUMBER_OF_TESTS; for(int t = 1; t <= NUMBER_OF_TESTS; t++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ROF(i, start, end) for(int i = (start); i >= (end); i--)
#define all(x) (x).begin(), (x).end()
//#define endl "\n"
#define PI (asin(1)*2)
#define oo 1000000000LL
#define OO 1000000000000000000LL
#define eps 1e-8
#define in(a, b)   ((b).find(a) != (b).end())
#define mp(a, b)   make_pair((a), (b))
#define sgn(a)     ((a) > eps ? 1 : ((a) < -eps ? -1 : 0))
#define cl1(x)     ((x)&((x)-1)) // clear lowest 1 bit
#define cl0(x)     ((x)|((x)+1)) // clear lowest 0 bit
#define ct1(x)     ((x)&((x)+1)) // clear all trailing 1 bits
#define pb push_back
#define MOD 1000000007
#define MAX_N 1000000
using namespace std;

bool visited[MAX_N];
vector<int> adjList[MAX_N];
int sz[MAX_N];
ll cnt[MAX_N];
ll n;
ll numOdd = 0;

pll dfs(int p, int par = -1) {
    pll ans = { 0,0 };
    vector<pll> sub;
    for(auto x : adjList[p]) {
        if (x == par) continue;
        auto res = dfs(x, p);
        sub.pb(res);
        ans.first += res.first;
        ans.second += res.second;
    }
    numOdd += ans.second;
    FOR(i, 0, sub.size() / 2) {
        auto x = sub[i];
        numOdd += x.first*(ans.second - x.second);
        numOdd += (ans.first - x.first) * x.second;
    }
    swap(ans.first, ans.second);
    ans.second++;
    return ans;
}

ll getSum() {
    FOR(i, 0, n) cnt[i] = 1;
    FOR(i, 0, n) visited[i] = false;
    stack<int> leaves;
    FOR(i, 0, n) {
        if (sz[i] == 1) leaves.push(i);
    }
    ll s = 0;
    while (!leaves.empty()) {
        auto t = leaves.top(); leaves.pop();
        visited[t] = true;
        int b = -1;
        for (auto x : adjList[t]) {
            if (!visited[x]) {
                b = x;
                sz[b]--;
                if (sz[b] == 1) leaves.push(b);
                break;
            }
        }
        s += cnt[t] * (n - cnt[t]);
        cnt[b] += cnt[t];
    }
    return s;
}

int main()
{
    FAST_IO
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> n;
    FOR(i, 0, n-1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        adjList[u].pb(v);
        adjList[v].pb(u);
        sz[u]++;
        sz[v]++;
    }
    auto r = dfs(0);
    ll firstSum = getSum();
    cout << (firstSum + numOdd) / 2;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:167772160000")
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <climits>
#include <set>
#include <bitset>
#include <math.h>
#include <queue>
#include <map>
#include <sstream>
#include <functional>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <regex>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::pair<double, double> pdd;
template <typename T> using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <typename T> using max_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;

#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define TESTS(t) int NUMBER_OF_TESTS; cin >> NUMBER_OF_TESTS; for(int t = 1; t <= NUMBER_OF_TESTS; t++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ROF(i, start, end) for(int i = (start); i >= (end); i--)
#define all(x) (x).begin(), (x).end()
//#define endl "\n"
#define PI (asin(1)*2)
#define oo 1000000000LL
#define OO 1000000000000000000LL
#define eps 1e-8
#define in(a, b)   ((b).find(a) != (b).end())
#define mp(a, b)   make_pair((a), (b))
#define sgn(a)     ((a) > eps ? 1 : ((a) < -eps ? -1 : 0))
#define cl1(x)     ((x)&((x)-1)) // clear lowest 1 bit
#define cl0(x)     ((x)|((x)+1)) // clear lowest 0 bit
#define ct1(x)     ((x)&((x)+1)) // clear all trailing 1 bits
#define pb push_back
#define MOD 1000000007
#define MAX_N 1000000
using namespace std;

bool visited[MAX_N];
vector<int> adjList[MAX_N];
int sz[MAX_N];
ll cnt[MAX_N];
ll n;
ll numOdd = 0;

pll dfs(int p, int par = -1) {
    pll ans = { 0,0 };
    vector<pll> sub;
    for(auto x : adjList[p]) {
        if (x == par) continue;
        auto res = dfs(x, p);
        sub.pb(res);
        ans.first += res.first;
        ans.second += res.second;
    }
    numOdd += ans.second;
    FOR(i, 0, sub.size() / 2) {
        auto x = sub[i];
        ans.first -= x.first;
        ans.second -= x.second;
        numOdd += x.first*(ans.second);
        numOdd += (ans.first) * x.second;
    }
    swap(ans.first, ans.second);
    ans.second++;
    return ans;
}

ll getSum() {
    FOR(i, 0, n) cnt[i] = 1;
    FOR(i, 0, n) visited[i] = false;
    stack<int> leaves;
    FOR(i, 0, n) {
        if (sz[i] == 1) leaves.push(i);
    }
    ll s = 0;
    while (!leaves.empty()) {
        auto t = leaves.top(); leaves.pop();
        visited[t] = true;
        int b = -1;
        for (auto x : adjList[t]) {
            if (!visited[x]) {
                b = x;
                sz[b]--;
                if (sz[b] == 1) leaves.push(b);
                break;
            }
        }
        s += cnt[t] * (n - cnt[t]);
        cnt[b] += cnt[t];
    }
    return s;
}

int main()
{
    FAST_IO
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> n;
    FOR(i, 0, n-1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        adjList[u].pb(v);
        adjList[v].pb(u);
        sz[u]++;
        sz[v]++;
    }
    auto r = dfs(0);
    ll firstSum = getSum();
    cout << (firstSum + numOdd) / 2;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:167772160000")
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <climits>
#include <set>
#include <bitset>
#include <math.h>
#include <queue>
#include <map>
#include <sstream>
#include <functional>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <regex>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::pair<double, double> pdd;
template <typename T> using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <typename T> using max_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;

#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define TESTS(t) int NUMBER_OF_TESTS; cin >> NUMBER_OF_TESTS; for(int t = 1; t <= NUMBER_OF_TESTS; t++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ROF(i, start, end) for(int i = (start); i >= (end); i--)
#define all(x) (x).begin(), (x).end()
//#define endl "\n"
#define PI (asin(1)*2)
#define oo 1000000000LL
#define OO 1000000000000000000LL
#define eps 1e-8
#define in(a, b)   ((b).find(a) != (b).end())
#define mp(a, b)   make_pair((a), (b))
#define sgn(a)     ((a) > eps ? 1 : ((a) < -eps ? -1 : 0))
#define cl1(x)     ((x)&((x)-1)) // clear lowest 1 bit
#define cl0(x)     ((x)|((x)+1)) // clear lowest 0 bit
#define ct1(x)     ((x)&((x)+1)) // clear all trailing 1 bits
#define pb push_back
#define MOD 1000000007
#define MAX_N 1000000
using namespace std;

bool visited[MAX_N];
vector<int> adjList[MAX_N];
int sz[MAX_N];
ll cnt[MAX_N];
ll n;
ll numOdd = 0;

pll dfs(int p, int par = -1) {
    pll ans = { 0,0 };
    vector<pll> sub;
    for(auto x : adjList[p]) {
        if (x == par) continue;
        auto res = dfs(x, p);
        sub.pb(res);
        ans.first += res.first;
        ans.second += res.second;
    }
    numOdd += ans.second;
    FOR(i, 0, sub.size() / 2) {
        auto x = sub[i];
        numOdd += x.first*(ans.second - x.second);
        numOdd += (ans.first - x.first) * x.second;
        ans.first -= x.first;
        ans.second -= x.second;
    }
    swap(ans.first, ans.second);
    ans.second++;
    return ans;
}

ll getSum() {
    FOR(i, 0, n) cnt[i] = 1;
    FOR(i, 0, n) visited[i] = false;
    stack<int> leaves;
    FOR(i, 0, n) {
        if (sz[i] == 1) leaves.push(i);
    }
    ll s = 0;
    while (!leaves.empty()) {
        auto t = leaves.top(); leaves.pop();
        visited[t] = true;
        int b = -1;
        for (auto x : adjList[t]) {
            if (!visited[x]) {
                b = x;
                sz[b]--;
                if (sz[b] == 1) leaves.push(b);
                break;
            }
        }
        s += cnt[t] * (n - cnt[t]);
        cnt[b] += cnt[t];
    }
    return s;
}

int main()
{
    FAST_IO
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> n;
    FOR(i, 0, n-1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        adjList[u].pb(v);
        adjList[v].pb(u);
        sz[u]++;
        sz[v]++;
    }
    auto r = dfs(0);
    ll firstSum = getSum();
    cout << (firstSum + numOdd) / 2;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:167772160000")
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <climits>
#include <set>
#include <bitset>
#include <math.h>
#include <queue>
#include <map>
#include <sstream>
#include <functional>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <regex>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::pair<double, double> pdd;
template <typename T> using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <typename T> using max_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;

#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define TESTS(t) int NUMBER_OF_TESTS; cin >> NUMBER_OF_TESTS; for(int t = 1; t <= NUMBER_OF_TESTS; t++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ROF(i, start, end) for(int i = (start); i >= (end); i--)
#define all(x) (x).begin(), (x).end()
//#define endl "\n"
#define PI (asin(1)*2)
#define oo 1000000000LL
#define OO 1000000000000000000LL
#define eps 1e-8
#define in(a, b)   ((b).find(a) != (b).end())
#define mp(a, b)   make_pair((a), (b))
#define sgn(a)     ((a) > eps ? 1 : ((a) < -eps ? -1 : 0))
#define cl1(x)     ((x)&((x)-1)) // clear lowest 1 bit
#define cl0(x)     ((x)|((x)+1)) // clear lowest 0 bit
#define ct1(x)     ((x)&((x)+1)) // clear all trailing 1 bits
#define pb push_back
#define MOD 1000000007
#define MAX_N 1000000
using namespace std;

bool visited[MAX_N];
vector<int> adjList[MAX_N];
int sz[MAX_N];
ll cnt[MAX_N];
ll n;
ll numOdd = 0;

pll dfs(int p, int par = -1) {
    pll ans = { 0,0 };
    vector<pll> sub;
    for(auto x : adjList[p]) {
        if (x == par) continue;
        auto res = dfs(x, p);
        sub.pb(res);
        ans.first += res.first;
        ans.second += res.second;
    }
    numOdd += ans.second;
    FOR(i, 0, sub.size()) {
        auto x = sub[i];
        ans.first -= x.first;
        ans.second -= x.second;
        numOdd += x.first*(ans.second);
        numOdd += (ans.first) * x.second;
    }
    swap(ans.first, ans.second);
    ans.second++;
    return ans;
}

ll getSum() {
    FOR(i, 0, n) cnt[i] = 1;
    FOR(i, 0, n) visited[i] = false;
    stack<int> leaves;
    FOR(i, 0, n) {
        if (sz[i] == 1) leaves.push(i);
    }
    ll s = 0;
    while (!leaves.empty()) {
        auto t = leaves.top(); leaves.pop();
        visited[t] = true;
        int b = -1;
        for (auto x : adjList[t]) {
            if (!visited[x]) {
                b = x;
                sz[b]--;
                if (sz[b] == 1) leaves.push(b);
                break;
            }
        }
        s += cnt[t] * (n - cnt[t]);
        cnt[b] += cnt[t];
    }
    return s;
}

int main()
{
    FAST_IO
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> n;
    FOR(i, 0, n-1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        adjList[u].pb(v);
        adjList[v].pb(u);
        sz[u]++;
        sz[v]++;
    }
    auto r = dfs(0);
    ll firstSum = getSum();
    cout << (firstSum + numOdd) / 2;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:167772160000")
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <climits>
#include <set>
#include <bitset>
#include <math.h>
#include <queue>
#include <map>
#include <sstream>
#include <functional>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <regex>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::pair<double, double> pdd;
template <typename T> using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <typename T> using max_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;

#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define TESTS(t) int NUMBER_OF_TESTS; cin >> NUMBER_OF_TESTS; for(int t = 1; t <= NUMBER_OF_TESTS; t++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ROF(i, start, end) for(int i = (start); i >= (end); i--)
#define all(x) (x).begin(), (x).end()
//#define endl "\n"
#define PI (asin(1)*2)
#define oo 1000000000LL
#define OO 1000000000000000000LL
#define eps 1e-8
#define in(a, b)   ((b).find(a) != (b).end())
#define mp(a, b)   make_pair((a), (b))
#define sgn(a)     ((a) > eps ? 1 : ((a) < -eps ? -1 : 0))
#define cl1(x)     ((x)&((x)-1)) // clear lowest 1 bit
#define cl0(x)     ((x)|((x)+1)) // clear lowest 0 bit
#define ct1(x)     ((x)&((x)+1)) // clear all trailing 1 bits
#define pb push_back
#define MOD 1000000007
#define MAX_N 1000000
using namespace std;

bool visited[MAX_N];
vector<int> adjList[MAX_N];
int sz[MAX_N];
ll cnt[MAX_N];
int n;
ll numOdd = 0;

pll dfs(int p, int par = -1) {
    visited[p] = true;
    pll ans = { 0,0 };
    vector<pll> sub;
    for (int i = 0; i < adjList[p].size(); i++)
    {
        int x = adjList[p][i];
        if (visited[x]) continue;
        auto res = dfs(x, p);
        sub.pb(res);
        ans.first += res.first;
        ans.second += res.second;
    }
    numOdd += ans.second;
    //numOdd += ans.first*ans.second;
    for (auto x : sub) {
        auto aa = ans;
        aa.first -= x.first;
        aa.second -= x.second;
        numOdd += x.first*aa.second;
        numOdd += aa.first * x.second;
    }
    swap(ans.first, ans.second);
    ans.second++;
    return ans;
}

ll getSum() {
    FOR(i, 0, n) cnt[i] = 1;
    FOR(i, 0, n) visited[i] = false;
    stack<int> leaves;
    FOR(i, 0, n) {
        if (sz[i] == 1) leaves.push(i);
    }
    ll s = 0;
    while (!leaves.empty()) {
        auto t = leaves.top(); leaves.pop();
        visited[t] = true;
        int b = -1;
        for (auto x : adjList[t]) {
            if (!visited[x]) {
                b = x;
                sz[b]--;
                if (sz[b] == 1) leaves.push(b);
                break;
            }
        }
        s += cnt[t] * (n - cnt[t]);
        cnt[b] += cnt[t];
    }
    return s;
}

int main()
{
    FAST_IO
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> n;
    FOR(i, 0, n-1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        adjList[u].pb(v);
        adjList[v].pb(u);
        sz[u]++;
        sz[v]++;
    }
    auto r = dfs(0);
    ll firstSum = getSum();
    cout << (firstSum + numOdd) / 2;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:167772160000")
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <climits>
#include <set>
#include <bitset>
#include <math.h>
#include <queue>
#include <map>
#include <sstream>
#include <functional>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <regex>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::pair<double, double> pdd;
template <typename T> using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <typename T> using max_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;

#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define TESTS(t) int NUMBER_OF_TESTS; cin >> NUMBER_OF_TESTS; for(int t = 1; t <= NUMBER_OF_TESTS; t++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ROF(i, start, end) for(int i = (start); i >= (end); i--)
#define all(x) (x).begin(), (x).end()
//#define endl "\n"
#define PI (asin(1)*2)
#define oo 1000000000LL
#define OO 1000000000000000000LL
#define eps 1e-8
#define in(a, b)   ((b).find(a) != (b).end())
#define mp(a, b)   make_pair((a), (b))
#define sgn(a)     ((a) > eps ? 1 : ((a) < -eps ? -1 : 0))
#define cl1(x)     ((x)&((x)-1)) // clear lowest 1 bit
#define cl0(x)     ((x)|((x)+1)) // clear lowest 0 bit
#define ct1(x)     ((x)&((x)+1)) // clear all trailing 1 bits
#define pb push_back
#define MOD 1000000007
#define MAX_N 1000000
using namespace std;

bool visited[MAX_N];
vector<int> adjList[MAX_N];
int sz[MAX_N];
ll cnt[MAX_N];
ll n;
ll numOdd = 0;

pll dfs(int p, int par = -1) {
    pll ans = { 0,0 };
    vector<pll> sub;
    for(auto x : adjList[p]) {
        if (x == par) continue;
        auto res = dfs(x, p);
        sub.pb(res);
        ans.first += res.first;
        ans.second += res.second;
    }
    numOdd += ans.second;
    auto old = ans;
    FOR(i, 0, sub.size()) {
        auto x = sub[i];
        ans.first -= x.first;
        ans.second -= x.second;
        numOdd += x.first*(ans.second);
        numOdd += (ans.first) * x.second;
    }
    ans = old;
    swap(ans.first, ans.second);
    ans.second++;
    return ans;
}

ll getSum() {
    FOR(i, 0, n) cnt[i] = 1;
    FOR(i, 0, n) visited[i] = false;
    stack<int> leaves;
    FOR(i, 0, n) {
        if (sz[i] == 1) leaves.push(i);
    }
    ll s = 0;
    while (!leaves.empty()) {
        auto t = leaves.top(); leaves.pop();
        visited[t] = true;
        int b = -1;
        for (auto x : adjList[t]) {
            if (!visited[x]) {
                b = x;
                sz[b]--;
                if (sz[b] == 1) leaves.push(b);
                break;
            }
        }
        s += cnt[t] * (n - cnt[t]);
        cnt[b] += cnt[t];
    }
    return s;
}

int main()
{
    FAST_IO
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> n;
    FOR(i, 0, n-1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        adjList[u].pb(v);
        adjList[v].pb(u);
        sz[u]++;
        sz[v]++;
    }
    auto r = dfs(0);
    ll firstSum = getSum();
    cout << (firstSum + numOdd) / 2;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:167772160000")
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <climits>
#include <set>
#include <bitset>
#include <math.h>
#include <queue>
#include <map>
#include <sstream>
#include <functional>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <regex>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::pair<double, double> pdd;
template <typename T> using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <typename T> using max_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;

#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define TESTS(t) int NUMBER_OF_TESTS; cin >> NUMBER_OF_TESTS; for(int t = 1; t <= NUMBER_OF_TESTS; t++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ROF(i, start, end) for(int i = (start); i >= (end); i--)
#define all(x) (x).begin(), (x).end()
//#define endl "\n"
#define PI (asin(1)*2)
#define oo 1000000000LL
#define OO 1000000000000000000LL
#define eps 1e-8
#define in(a, b)   ((b).find(a) != (b).end())
#define mp(a, b)   make_pair((a), (b))
#define sgn(a)     ((a) > eps ? 1 : ((a) < -eps ? -1 : 0))
#define cl1(x)     ((x)&((x)-1)) // clear lowest 1 bit
#define cl0(x)     ((x)|((x)+1)) // clear lowest 0 bit
#define ct1(x)     ((x)&((x)+1)) // clear all trailing 1 bits
#define pb push_back
#define MOD 1000000007
#define MAX_N 1000000
using namespace std;

bool visited[MAX_N];
vector<int> adjList[MAX_N];
int sz[MAX_N];
ll sum1[MAX_N], sum2[MAX_N];
ll cnt[MAX_N];
int n;
ll numOdd = 0;

pii dfs(int p, int par = -1) {
    visited[p] = true;
    pii ans = { 0,0 };
    vector<pii> sub;
    for (int i = 0; i < adjList[p].size(); i++)
    {
        int x = adjList[p][i];
        if (visited[x]) continue;
        auto res = dfs(x, p);
        sub.pb(res);
        ans.first += res.first;
        ans.second += res.second;
    }
    numOdd += ans.second;
    for (auto x : sub) {
        auto aa = ans;
        aa.first -= x.first;
        aa.second -= x.second;
        numOdd += aa.first*aa.second;
    }
    swap(ans.first, ans.second);
    ans.second++;
    return ans;
}

ll getSum() {
    FOR(i, 0, n) cnt[i] = 1;
    FOR(i, 0, n) visited[i] = false;
    stack<int> leaves;
    FOR(i, 0, n) {
        if (adjList[i].size() == 1) leaves.push(i);
    }
    ll s = 0;
    while (!leaves.empty()) {
        auto t = leaves.top(); leaves.pop();
        visited[t] = true;
        int b = -1;
        for (auto x : adjList[t]) {
            if (!visited[x]) {
                b = x;
                sz[b]--;
                if (sz[b] == 1) leaves.push(b);
                break;
            }
        }
        s += cnt[t] * (n - cnt[t]);
        cnt[b] += cnt[t];
    }
    return s;
}

int main()
{
    FAST_IO
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> n;
    FOR(i, 0, n-1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        adjList[u].pb(v);
        adjList[v].pb(u);
        sz[u]++;
        sz[v]++;
    }
    auto r = dfs(0);
    ll firstSum = getSum();
    cout << (firstSum + numOdd) / 2;
    return 0;
}