// AOJ DSL_4_A Union of Rectangles
// 2018.5.14 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define MAX_N 2005
#define MAX   4005

typedef struct { int x1, y1, x2, y2; } TBL;
TBL tbl[MAX_N];

int x[MAX], xs;
int y[MAX], ys;
short s[MAX][MAX];

int cmp(int *a, int *b) { return *a - *b; }

int xbsch(int a)
{
	int m, l = 0, r = xs;

    while (l < r) {
        m = (l + r) >> 1;
        if (x[m] < a) l = m + 1; else r = m;
    }
	return l;
}
int ybsch(int a)
{
	int m, l = 0, r = ys;

    while (l < r) {
        m = (l + r) >> 1;
        if (y[m] < a) l = m + 1; else r = m;
    }
	return l;
}

int uniq(int *a, int n)
{
	int i, j;
	
	for (i = 0, j = 1; j < n; j++) {
		while (j < n && a[j] == a[i]) j++;
		if (j < n) if (++i != j) a[i] = a[j];
	}
	return i+1;
}

int main()
{
	int N, i, j, x1, y1, x2, y2;
	long long ans;

	N = in(); xs = ys = 0;
	for (i = 0; i < N; i++) {
		tbl[i].x1 = x1 = in(), tbl[i].y1 = y1 = in();
		tbl[i].x2 = x2 = in(), tbl[i].y2 = y2 = in();
		x[xs++] = x1, x[xs++] = x2;
		y[ys++] = y1, y[ys++] = y2;
	}
	qsort(x, xs, sizeof(int), cmp); // xs = uniq(x, xs);
	qsort(y, ys, sizeof(int), cmp); // ys = uniq(y, ys);

	for (j = 0, i = 0; i < N; i++) {
		x1 = xbsch(tbl[i].x1), x2 = xbsch(tbl[i].x2);
		y1 = ybsch(tbl[i].y1), y2 = ybsch(tbl[i].y2);

		s[y1][x1]++, s[y1][x2]--;
		s[y2][x1]--, s[y2][x2]++;
	}

	ans = 0;
	for (j = 0; j < ys; j++) {
		for (i = 1; i < xs; i++) s[j][i] += s[j][i-1];
	}

	for (j = 1; j < ys; j++) {
		for (i = 0; i < xs; i++) s[j][i] += s[j-1][i];
	}

	for (j = 0; j < ys; j++) {
		for (i = 0; i < xs; i++) if (s[j][i]) {
			ans += (long long)(x[i+1]-x[i])*(long long)(y[j+1]-y[j]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}

