<?xml version="1.0" encoding="Windows-1251"?>
<CATS version="1.2">
<Problem title="Count Squares" lang="en"
  author="B. Vasilyev, A. Klenin" tlimit="3" mlimit="4"
  inputFile="input.txt" outputFile="output.txt" stdChecker="nums">

<ProblemStatement>
 <p>Given a set of points with integer coordinates $x_i, y_i$, $i = 1 \ldots N$,
   your program must find all the squares having each of four vertices in one of these points.</p>
</ProblemStatement>
<ProblemConstraints>
 $-10^4 \le x_i, y_i \le 10^4$, $1 \le N \le 2000$.
 All points in the input are different.
</ProblemConstraints>

<InputFormat>
 Input file contains integer $N$ followed by $N$ pairs of integers $x_i$ $y_i$.
</InputFormat>

<OutputFormat>
 Output file must contain a single integer -- number of squares found.
</OutputFormat>

<Sample rank="1">
  <SampleIn>4 0 0 4 3 -3 4 1 7</SampleIn>
  <SampleOut>1</SampleOut>
</Sample>
<Sample rank="2">
  <SampleIn>9
1 1  1 2  1 3  
2 1  2 2  2 3  
3 1  3 2  3 3</SampleIn>
  <SampleOut>6</SampleOut>
</Sample>

<Generator name="genSq" src="genSq.dpr" outputFile="*STDOUT" />
<Generator name="genCir" src="genCir.dpr"  outputFile="*STDOUT" />
<Generator name="genRand" src="genRand.dpr"  outputFile="*STDOUT" />
<Generator name="genRndSq" src="genRndSq.dpr"  outputFile="*STDOUT" />
<Solution name="sol_ask_n3" src="countsq_n3.dpr" />
<Solution name="sol" src="squares_tim.dpr" />

<TestRange from="1" to="3"><In src="%0n" /><Out use="sol"/></TestRange>
<Test rank="4"><In use="genSq" param="4" /><Out use="sol"/></Test>
<Test rank="5"><In use="genCir" param="99 50" /><Out use="sol"/></Test>
<Test rank="6"><In use="genRand" param="400 199" /><Out use="sol"/></Test>
<Test rank="7"><In use="genSq" param="35" /><Out use="sol"/></Test>
<Test rank="8"><In use="genCir" param="1499 9000" /><Out use="sol"/></Test>
<Test rank="9"><In use="genCir" param="1499 750" /><Out use="sol"/></Test>
<Test rank="10"><In use="genCir" param="1999 1000" /><Out use="sol"/></Test>

<Test rank="11"><In use="genRand" param="2000 57" /><Out use="sol"/></Test>
<Test rank="12"><In use="genRand" param="2000 58" /><Out use="sol"/></Test>
              
<Test rank="13"><In use="genRndSq" param="556789 300 40 100" /><Out use="sol"/></Test>
<Test rank="14"><In use="genRndSq" param="501 1000 10 100" /><Out use="sol"/></Test>
<Test rank="15"><In use="genRndSq" param="365 1500 70 300" /><Out use="sol"/></Test>
<Test rank="16"><In use="genRndSq" param="636 1500 70 200" /><Out use="sol"/></Test>
<Test rank="17"><In use="genRndSq" param="23 1500 40 100" /><Out use="sol"/></Test>
<Test rank="18"><In use="genRndSq" param="76884 1500 500 10000" /><Out use="sol"/></Test>

<Test rank="19"><In use="genRndSq" param="123 2000 40 100" /><Out use="sol"/></Test>
<Test rank="20"><In use="genRndSq" param="456 2000 500 10000" /><Out use="sol"/></Test>

</Problem>
</CATS>
