#include <stdio.h>
long long n, a, c, u, v;
int main() {
	scanf("%lld", &n);
	for (long long i = 1; i <= n; i++) {
		a += i * (n + 1 - i);
	}
	for (long long i = 1; i < n; i++) {
		scanf("%lld %lld", &u, &v);
		if (u > v) {
			c = u;
			u = v;
			v = c;
		}
		a -= u * (n + 1 - v);
	}
	printf("%lld\n", a);
}