Rectangles-3
Long ago in a three-dimensional space-lived fared rectangles. These were highly moral, duhovnoobogaschennye and symmetrical creatures. However, in their hearts they were flat and rectangular. And the corners, as we know, there are sharp. In general, the quarrel became rectangles. Thousands have lasted centuries, domestic conflicts over division of territory. Each rectangle quarreled with all the other boxes, with whom he had shared at least one point in space (highly spiritual beings are not material and may overlap in space). Rectangles are feuding, even if for only one point. By some intelligible only to these creatures causes a quadrilateral, each rectangle is located in space parallel to one of the coordinate plane and its edges are parallel to the axes. But here's a solution the problem of strife! Savvy figures appealed for help to you. To resolve the conflicts they must calculate how many pairs of conflicting rectangles is in habitable space.
Input
In the first line of the input file contains the number n (1 ≤ n ≤ 100000) - the number of rectangles. Followed by n lines containing descriptions of each rectangle. Each description consists of six integers - the coordinates of two opposite corners of the rectangle. All coordinates - the integers from 1 to 999.
Output
Display the number of conflicting pairs of rectangles.