{
TASK:colxor
LANG:Pascal
}

program ColXor;

type PBlock = ^TBlock;
     TBlock = record
      X, Y: smallint;
      Next: PBlock;
     end;

var Blocks: PBlock;
    Answer: Int64;
    N, R: Integer;

procedure AddBlock(var ABlock: PBlock; const aX, aY: smallint);
var Temp: PBlock;
begin
 New(Temp);
 Temp^.X := aX;
 Temp^.Y := aY;
 Temp^.Next := ABlock;
 ABlock := Temp;
end;

procedure RemoveBlock(var ABlock: PBlock);
var Temp: PBlock;
begin
 If (ABlock = nil) then Exit;
 If not(ABlock^.Next = nil) then begin
  Temp := ABlock^.Next;
  ABlock^.Next := (ABlock^.Next)^.Next;
  ABlock^.X := Temp^.X;
  ABlock^.Y := Temp^.Y;
  Dispose(Temp);
 end else begin
  Temp := ABlock;
  ABlock := nil;
  Dispose(Temp);
 end;
end;

procedure TerminateBlocks(var ABlock: PBlock);
var Temp: PBlock;
begin
 Temp := ABlock;
 while not(ABlock = nil) do begin
  Temp := ABlock^.Next;
  Dispose(ABlock);
  ABlock := Temp;
 end;
end;

procedure ProcessBlock(const aX, aY: smallint);
var Check: PBlock;
begin
 Check := Blocks;

 while not(Check = nil) do begin

  If (Check^.X = aX) and (Check^.Y = aY) then begin
   RemoveBlock(Check);
   Dec(Answer);
   Exit;
  end;

  Check := Check^.Next;

 end;

 AddBlock(Blocks,aX,aY);
 Inc(Answer);
end;

function BlockInCircle(const bX, bY, cX, cY: smallint): Boolean;
begin
 BlockInCircle := False;

 If (bX > cX) then begin

  If (bY < cY) then begin
   If (Sqr(cX - bX) + Sqr(cY - (bY + 1)) < Sqr(R)) then BlockInCircle := True;
  end else begin
   If (Sqr(cX - bX) + Sqr(bY - cY) < Sqr(R)) then BlockInCircle := True;
  end;

 end else begin

  If (bY < cY) then begin
   If (Sqr(cX - (bX + 1)) + Sqr(cY - (bY + 1)) < Sqr(R)) then BlockInCircle := True;
  end else begin
   If (Sqr(cX - (bX + 1)) + Sqr(bY - cY) < Sqr(R)) then BlockInCircle := True;
  end;

 end;
end;

procedure ProcessCircle(const aX, aY: smallint);
var X, Y: smallint;
begin
 for X := aX - R to aX + R do begin
  for Y := aY - R to aY + R do begin

   If (BlockInCircle(X,Y,aX,aY)) then ProcessBlock(X,Y);

  end;
 end;
end;

procedure Input;
var iCircle, N: Integer;
    aX, aY: smallint;
begin
 ReadLn(N,R);
 for iCircle := 1 to N do begin
  ReadLn(aX,aY);
  ProcessCircle(aX,aY);
 end;
end;

begin
 Answer := 0;
 Input;
 WriteLn(Answer);
 TerminateBlocks(Blocks);
end.
