#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;

int n;
double x[100],y[100];

inline double square(double a){
	return a*a;
}
bool in(double a,double b,int i){
	return square(a-x[i])+square(b-y[i])<=1.0;
}
int main(){
	char ch;
	while(cin>>n&&n){
		int ans=0,s;
		for(int i=0;i<n;i++)cin>>x[i]>>ch>>y[i];
		for(int i=0;i<n;i++){
			for(int j=0;j<1000;j++){
				double a=x[i]+cos(2*M_PI*j/1000);
				double b=y[i]+sin(2*M_PI*j/1000);
				s=0;			
				for(int k=0;k<n;k++)if(in(a,b,k))s++;
				ans = max(ans,s);
			}
		}
		cout<<ans<<endl;
	}
}