#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
typedef pair<double,double> P;
#define eps 1e-7
#define fi first
#define sec second
int n,ans;
P circle[105];
double sq(double x){return x*x;}
double culc_dist(int s,int t)
{
	P a=circle[s],b=circle[t];
	return sqrt(sq(a.fi-b.fi)+sq(a.sec-b.sec));
}
double dist(P a,P b)
{
	return sqrt(sq(a.fi-b.fi)+sq(a.sec-b.sec));
}
bool is_intersect(int s,int t)
{
	return culc_dist(s,t)<=2.0+eps;
}
P center_pos(int s,int t)
{
	P a=circle[s],b=circle[t];
	return P((a.fi+b.fi)/2,(a.sec+b.sec)/2);
}
P normal_vector(int s,int t)
{
	P a=circle[s],b=circle[t];
	return P(a.sec-b.sec,b.fi-a.fi);
}
P expand(int s,int t)
{
	P n=normal_vector(s,t);
	double sin_x=sqrt(1-(sq(culc_dist(s,t))/4));
	double len=sqrt(sq(n.fi)+sq(n.sec));
	return P(n.fi*sin_x/len,n.sec*sin_x/len);
}
int culc_covered(P p)
{
	if(p.fi<0||p.fi>10||p.sec<0||p.sec>10)return 0;
	int ret=0;
	for(int i=0;i<n;i++)if(dist(p,circle[i])<=1.0+eps)ret++;
	return ret;
}
int main()
{
	while(1)
	{
		cin >> n;
		if(n==0)return 0;
		ans=1;
		for(int i=0;i<n;i++)scanf("%lf,%lf",&circle[i].fi,&circle[i].sec);
		for(int i=0;i<n;i++)
		{
			for(int j=i+1;j<n;j++)
			{
				if(!is_intersect(i,j))continue;
				P center=center_pos(i,j);
				P orientation=expand(i,j);
				ans=max(ans,culc_covered(P(center.fi-orientation.fi,center.sec-orientation.sec)));
				if(!(abs(orientation.fi)<eps&&abs(orientation.sec)<eps))ans=max(ans,culc_covered(P(center.fi+orientation.fi,center.sec+orientation.sec)));
			}
		}
		cout << ans << endl;
	}
	return 0;
}