{$APPTYPE CONSOLE}

uses
  Math;

type TLineRec = record d, v: Integer; end;

var
  x, y: array of Integer;
  N, cur: Integer;
  lines: array of array of TLineRec;

  function dist2(pt1, pt2: Integer): Integer;
  begin
    Result := Sqr(x[pt1] - x[pt2]) + Sqr(y[pt1] - y[pt2]);
  end;

  procedure QuickSort(L, R: Integer);
  var
    i, j, p: Integer;
    t: TLineRec;
  begin
    repeat
      i := L;
      j := R;
      p := lines[cur][(L + R) shr 1].d;
      repeat
        while lines[cur][i].d < P do Inc(i);
        while lines[cur][j].d > P do Dec(j);
        if i <= j then begin
          t := lines[cur][i];
          lines[cur][i] := lines[cur][j];
          lines[cur][j] := T;
          Inc(i); Dec(j);
        end;
      until i > j;
      if L < j then
        QuickSort(L, j);
      L := i;
    until i >= R;
  end;

  procedure BinSearch(var a, b: Integer; d: integer);
  var
    i: integer;
  begin
    while a <= b do begin
      i := (a + b) div 2;
      case CompareValue(lines[cur][i].d, d) of
      -1: a := i + 1;
      1: b := i - 1;
      0: begin
        a := i;
        while (a > 1) and (lines[cur][a].d = d) do Dec(a);
        b := i;
        while (b <= N) and (lines[cur][b].d = d) do Inc(b);
        break;
      end;
      end;
    end;
  end;

var
  f: TextFile;
  i, j, k, c, side, squares, a, b: Integer;

begin
//  AssignFile(f, 'input.txt'); Reset(f);
  Read(N);
  SetLength(x, N + 1);
  SetLength(y, N + 1);
  for i := 1 to N do Read(x[i], y[i]);
//  CloseFile(f);

  SetLength(lines, N + 1, N + 1);
  for cur := 1 to N do begin
    for j := 1 to N do begin
      lines[cur, j].d := dist2(cur, j);
      lines[cur, j].v := j;
    end;
    QuickSort(1, N);
  end;

  squares := 0;
  for cur := 1 to N - 1 do begin
    for j := cur + 1 to N do begin
      side := dist2(cur, j);
      if side mod 2 = 1 then continue;
      side := side div 2;
      c := 0;
      a := 1; b := N;
      BinSearch(a, b, side);
      for k := a to b do
        if dist2(j, lines[cur][k].v) = side then begin
          Inc(c);
          if c = 2 then begin
            Inc(squares);
            break;
          end;
        end;
    end;
  end;
//  AssignFile(f, 'output.txt'); Rewrite(f);
  Write(squares div 2);
//  CloseFile(f);
end.

