### COCI 2006/2007, Contest #6

A long time ago in a three-dimensional space far away, a tribe of rectangles lived happily. The rectangles lived a spiritual life, parallel with one of the coordinate planes.

One day, a cuboid walked into their small world, riding steadily on an icosahedron, showing off its sharp corners and positive volume. The rectangles watched in awe and dreamed of being cuboids. Nothing would ever be the same from that day on. The rectangles started comparing each other by area, perimeter and even by the ratio of the lengths of their sides.

Soon the first conflict ensued over the ownership of shared points. In time, each pair of rectangles sharing at least one point (including those merely touching each other) got into a conflict and became enemies.

It is up to you to restore peace in the community, by meeting with every pair of rectangles in conflict. Write a program that finds how many such pairs there are.

### Input

The first line of input contains the integer N (1 ≤ N ≤ 100 000), the number of rectangles.

Each of the following N lines contains 6 integers separated by single spaces. The first three numbers represent the coordinates of one corner of the rectangle, the other three are the coordinates of the opposite corner.

The coordinates are integers between 1 and 999 (inclusive).

Each rectangle is parallel to one of the coordinate planes, meaning that in exactly one of the three dimensions, the two corresponding coordinates will be equal.

### Output

Output the total number of rectangles in conflict on a single line.

```3
1 1 1 1 3 3
1 3 3 1 6 6
1 4 4 1 5 5
```

```2
```

### Input

```3
15 10 10 15 20 20
10 15 10 20 15 20
10 10 15 20 20 15
```

```3
```

```5
4 4 5 4 3 2
5 3 2 4 3 1
5 4 3 1 1 3
1 4 3 1 5 4
5 5 4 5 4 2
```

### Output

```4
```

Point Value: 30 (partial)
Time Limit: 2.00s
Memory Limit: 32M

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3