Little I is learning calligraphy, but when he opened his blank paper, he remembered that he had previously doodled $n$ line segments on it, leaving the rest of the paper white.
These $n$ blackened line segments are either horizontal or vertical. Using the center of the paper as the origin, with the $x$-axis and $y$-axis parallel to the edges of the paper, each blackened line segment with endpoints $(x_1, y_1)$ and $(x_2, y_2)$ satisfies exactly one of $x_1 = x_2$ or $y_1 = y_2$. Furthermore, no two horizontal line segments intersect, and no two vertical line segments intersect.
Although the blackened segments are annoying, Little I, who understands that fortune and misfortune are intertwined, discovered that the $n$ segments form several "tian-zi" grids (grid squares), which he can use for calligraphy practice.
A "tian-zi" grid can be described by a triple $(x_0, y_0, d)$. A triple $(x_0, y_0, d)$ is a "tian-zi" grid if and only if the following conditions are met:
- $x_0, y_0 \in \mathbb{R}$, $d \in \mathbb{R}^+$;
- Let $R = [x_0-d, x_0+d] \times [y_0-d, y_0+d]$ be the set of all points with $x$-coordinates in $[x_0-d, x_0+d]$ and $y$-coordinates in $[y_0-d, y_0+d]$. The blackened part within $R$ consists exactly of six line segments, which are the intersections of $R$ with the lines $x=x_0-d$, $x=x_0$, $x=x_0+d$, $y=y_0-d$, $y=y_0$, and $y=y_0+d$.
Little I wants to calculate how many "tian-zi" grids are on the paper, i.e., how many triples $(x_0, y_0, d)$ satisfy the above conditions. As usual, Little I cannot calculate this, so he has entrusted the task to you.
Input
The first line contains an integer $n$ ($1 \le n \le 3 \times 10^5$), representing the number of line segments. Each of the next $n$ lines contains four integers $x_1, y_1, x_2, y_2$ ($-10^9 \le x_1 \le x_2 \le 10^9, -10^9 \le y_1 \le y_2 \le 10^9$), representing a line segment.
Each line segment in the input satisfies exactly one of $x_1 = x_2$ or $y_1 = y_2$. Additionally, no two line segments with $x_1 = x_2$ intersect, and no two line segments with $y_1 = y_2$ intersect.
Output
Output a single integer representing the number of "tian-zi" grids.
Examples
Input 1
10
-10 -10 -10 10
0 -10 0 10
10 -10 10 10
-10 -10 10 -10
-10 0 10 0
-10 10 10 10
5 -10 5 10
-10 5 10 5
-2 0 -2 10
-5 -5 10 -5
Output 1
3
Note
- $(0, 0, 10)$, because there are blackened parts other than the required six line segments;
- $(-5, 5, 5)$, because the intersection of $x=-5$ with the square is not blackened.