#include<iostream>
#include<map>
#include<cstdio>
#include<vector>
using namespace std;
//typedef pair<double,double> P;
int main()
{
  int n;
  for(;scanf("%d",&n),n;)
    {
      //      P circle[n];
      //      pair<double,double> circle[n];
      vector<pair<double,double> >circle;
      for(int i=0;i<n;i++)
	{
	  //	  scanf("%lf,&lf",&circle[i].first,&circle[i].second);
	  double tmp1,tmp2;
	  char buf;
	  cin>>tmp1>>buf>>tmp2;
	  circle.push_back(make_pair(tmp1,tmp2));
	}
      int ans=0;
      for(int i=0;i<n;i++)
	{
	  int count=0;
	  for(int j=0;j<n;j++)      
	    {
	      //	      if(i!=j)
	      //		{
		  double xc1=circle[i].first;
		  double xc2=circle[j].first;
		  double yc1=circle[i].second;
		  double yc2=circle[j].second;		  
		  if((xc1-xc2)*(xc1-xc2)+(yc1-yc2)*(yc1-yc2)<=4.0)
		    count++;
		  //	}
	    }
	  ans=max(count,ans);
	}
      printf("%d\n",ans);
    }
}