Chef and The Right Triangles

All submissions for this problem are available.
The Chef is given a list of N triangles. Each triangle is identfied by the coordinates of its three corners in the 2D cartesian plane. His job is to figure out how many of the given triangles are right triangles. A right triangle is a triangle in which one angle is a 90 degree angle. The vertices of the triangles have integer coordinates and all the triangles given are valid( three points aren't colinear ).
Input
The first line of the input contains an integer N denoting the number of triangles. Each of the following N lines contain six space separated integers x1 y1 x2 y2 x3 y3 where (x1, y1), (x2, y2) and (x3, y3) are the vertices of a triangle.
Output
Output one integer, the number of right triangles among the given triangles.
Constraints
 1 ≤ N ≤ 100000 (10^{5})
 0 ≤ x1, y1, x2, y2, x3, y3 ≤ 20
Example
Input: 5 0 5 19 5 0 0 17 19 12 16 19 0 5 14 6 13 8 7 0 4 0 14 3 14 0 2 0 14 9 2 Output: 3
Explanation
The first triangle and the last two triangles of the example are right triangles.
Author:  rustinpiece 
Tester:  rubanenko 
Editorial  http://discuss.codechef.com/problems/RIGHTRI 
Tags  cook37, easy, geometry, rustinpiece 
Date Added:  8082013 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions