<?php

define("R", 1.0);

$x = array();
$y = array();

while(true){
	$num = intval(fgets(STDIN));
	if($num == 0){
		break;
	}
	mainLoop();
}



function mainLoop(){
	global $x, $y, $num;
	
	$x = array();
	$y = array();
	
	for($i = 0; $i < $num; $i++){
		$buf = fgets(STDIN);
		$arr = explode(",", $buf);
		$x[$i] = floatval($arr[0]);
		$y[$i] = floatval($arr[1]);
	}
	
	// 交点探す
	$max = 0;
	for($i = 0; $i < $num - 1; $i++){
		for($j = $i + 1; $j < $num; $j++){
			$p = koten($i, $j);
			if($p > $max){
				$max = $p;
			}
		}
	}
	
	echo $max."\n";
}


/**
 * t = ±√(r^2/{(x2 - x1)^2 + (y2 - y1)^2} - 1/4)
   x = -(y2 - y1)*t + (x1 + x2)/2
   y =  (x2 - x1)*t + (y1 + y2)/2
 */
function koten($i, $j){
	global $x, $y;
	
	$x1 = $x[$i]; $y1 = $y[$i];
	$x2 = $x[$j]; $y2 = $y[$j];
	
	// 中点
	$cx = ($x1 + $x2)*0.5;
	$cy = ($y1 + $y2)*0.5;
	
	$r2 = ($x2 - $x1)*($x2 - $x1) + ($y2 - $y1)*($y2 - $y1);
	if($r2 > 4*R*R){
		// 交わってない
		$ret = 1;
		
	}else if($r2 == 4*R*R){
		// 接してる
		$ret = koten2($i, $j, $cx, $cy);
		
	}else{
		// 交わってる
		$t = sqrt(R*R/$r2 - 0.25);
		
		$px = -($y2 - $y1)*$t + $cx;
		$py =  ($x2 - $x1)*$t + $cy;
		$ret1 = koten2($i, $j, $px, $py);
		
		$t = -$t;
		$px = -($y2 - $y1)*$t + $cx;
		$py =  ($x2 - $x1)*$t + $cy;
		$ret2 = koten2($i, $j, $px, $py);
		
		if($ret1 > $ret2){
			$ret = $ret1;
		}else{
			$ret = $ret2;
		}
	}
	
	return $ret;
}


function koten2($i, $j, $px, $py){
	global $x, $y, $num;
	
	$ret = 0;
	for($k = 0; $k < $num; $k++){
		if($i == $k || $j == $k){
			$ret++;
			continue;
		}
		
		$r2 = ($x[$k] - $px)*($x[$k] - $px) + ($y[$k] - $py)*($y[$k] - $py);
		if($r2 <= R*R + 0.000001){
			// 円の内側
			$ret++;
		}
	}
	
	return $ret;	
}