#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;
#define pb push_back
#define X first
#define Y second
typedef pair <double,double>P;

double dis(P a,P b){
	//2点間距離
	return sqrt((a.X-b.X)*(a.X-b.X)+(a.Y-b.Y)*(a.Y-b.Y));
}



int main(){
	
	int n;
	while(cin>>n,n){
		vector<P>V;
		for(int i=0;i<n;i++){
			double x,y;
			scanf("%lf,%lf",&x,&y);
			V.pb(P(x,y));
		}
		int ans=1;
		
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				if(dis(V[i],V[j])<=2.0){
					double rad=acos(dis(V[i],V[j])/2.0);
					double cta=0;
					if(dis(V[i],V[j])>0){
						cta=acos(fabs(V[i].X-V[j].X)/dis(V[i],V[j]));
					}
					
					double x=V[i].X+cos(rad+cta),y=V[i].Y+sin(rad+cta);
					int tmp=0;
					for(int i=0;i<n;i++){
						if(dis(V[i],P(x,y))<=1)tmp++;
					}
					ans=max(ans,tmp);
					
					x=V[i].X+cos(rad-cta);
					y=V[i].Y+sin(rad-cta);
					tmp=0;
					for(int i=0;i<n;i++){
						if(dis(V[i],P(x,y))<=1)tmp++;
					}
					ans=max(ans,tmp);
					
					
				}
			}
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}
