<?php

while(($n = trim(fgets(STDIN))) > 0) {
	$seals = array();

	for ($i = 0; $i < $n; $i++) {
		list($x, $y) = explode(',', trim(fgets(STDIN)));
		$seals[] = new Circle($x, $y, 1);
	}
	$max = 0;
	foreach ($seals as $me) {
		$overlap = 0;
		foreach ($seals as $you) {
			if ($me->isOverlappedWith($you)) {
				$overlap++;
			}
		}
		$max = max($max, $overlap);
	}
	echo $max . "\n";
}

class Circle {
	public $x;
	public $y;
	public $r;

	public function __construct($x, $y, $r) {
		$this->x = $x;
		$this->y = $y;
		$this->r = $r;
	}

	public function distance(Circle $c) {
		return sqrt(($this->x - $c->x) * ($this->x - $c->x) + ($this->y - $c->y) * ($this->y - $c->y));
	}

	public function isOverlappedWith(Circle $c) {
		return $this->distance($c) < $this->r + $c->r;
	}
}