#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n;
double x[101],y[101],a[101][101];
int main(){
  while(cin>>n,n){
    r(i,n)scanf("%lf,%lf",&x[i],&y[i]);
    memset(a,0,sizeof(a));
    r(i,n)r(j,n)a[i][j]=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
    int ans=0;
    r(i,n){
      vector<int>v;
      v.push_back(i);
      int res=1;
      for(int j=i+1;j<n;j++)
	r(k,v.size())if(a[v[k]][j]<=2){
	  v.push_back(j);
	  res++;
	  break;
	}
      ans=max(ans,res);
    }
    cout<<ans<<endl;
  }
}