import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;

const real eps = 1e-10;
void main() {
	int n = to!int(readln().chomp());
	while(n != 0) {
		Complex!real[] centor;
		for(int i; i < n; ++i){
			auto s = readln().strip().split(",");
			centor ~= complex(to!real(s[0]), to!real(s[1]));
		}
		Complex!real[] cross;
		for(int i; i < n; ++i){
			for(int j = i+1; j < n; ++j){
				if(((centor[i]-centor[j]).abs()-2).abs() < eps){
					auto m = (centor[i]+centor[j])/2;
					auto d = std.complex.expi((m-centor[i]).arg()+PI_2)*sqrt(1-pow((m-centor[i]).abs(),2));
					cross ~= m+d;
					cross ~= m-d;
				}
			}
		}
		int ans = 1;
		foreach(Complex!real c; cross) {
			int sum = 0;
			for(int i; i < n; ++i) {
				if(((c-centor[i]).abs()-1).abs() < eps)
					++sum;
			}
			ans = max(ans, sum);
		}
		writeln(ans);
		n = to!int(readln().chomp());
	}
}