#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>
using namespace std;
struct P{double x,y;};
#define rep(i,n) for(int i=0;i<n;i++)
static const double PI = 6*asin( 0.5 );

const double EPS = 1e-15;

vector<P> cross(P a, P b){
	vector<P> ret;
	P z = a ; a.x = 0 , a.y = 0 , b.x -= z.x , b.y -= z.y;
	double x = a.x - b.x , y = a.y - b.y;
	double L = x * x + y * y;
	if(L > 4.0)return ret;
	
	L = sqrt(L);
	double C = atan2( a.x-a.x , b.y-a.y);
	
	double co = L/2;
	
	double alpha = acos(co);
	
	if(b.x == a.x && C+alpha == 0)C = PI/2;
	
	P r1,r2;
	
	r1.x = z.x + cos(C+alpha) , r1.y = z.y + sin(C+alpha);
	r2.x = z.x + cos(C-alpha) , r2.y = z.y + sin(C-alpha);
	
//	cout << cos(0) << endl;
//	cout << (alpha*180)/3.141592 << endl;
	/*if(r1.x < EPS)r1.x = 0; if(r1.y < EPS)r1.y = 0;
	if(r2.x < EPS)r2.x = 0; if(r2.y < EPS)r2.y = 0;*/
	ret.push_back(r1);
	if(r1.x != r2.x || r1.y != r2.y)ret.push_back(r2);
	return ret;
}

bool check(P cir , P pt){
	cir.x -= pt.x , cir.y -= pt.y;
	return (cir.x*cir.x + cir.y * cir.y) <= 1 + EPS;
}
int main(){
	int n;
	while(scanf("%d",&n),n){
		int ret = 0;
		vector<P> data(n);
		vector<P> search;
		rep(i,n)scanf("%lf,%lf\n",&data[i].x,&data[i].y);
		
		rep(i,n){
			for(int j=i+1;j<n;j++){
				vector<P> get = cross(data[i],data[j]);
				//cout << "[" << i+1 << "]" << "(" << data[i].x << "," << data[i].y << ")" << " and " << "[" << j+1 << "]" << "(" << data[j].x << "," << data[j].y << ") = ";
				rep(k,get.size()){
				//	cout << " " << "(" << get[k].x << "," << get[k].y << ")" << " ";
					search.push_back(get[k]);
				}
				//cout << endl;
			}
		}
		rep(i,search.size()){
			int count = 0;
			rep(j,n){
				count += check(data[j],search[i]);
			}
			ret = max(ret,count);
		}
		cout << ret << endl;
	}
}