#include<bits/stdc++.h>
using namespace std;
int n,a[101][101];
double x[101],y[101];
bool used[101];
int dfs(int x){
  int res=1;
  used[x]=1;
  for(int i=0;i<n;i++)
    if(a[x][i]&&(!used[i]))
      res+=dfs(i);
  return res;
}
int main(){
  while(cin>>n,n){
    for(int i=0;i<n;i++)
      scanf("%lf,%lf",&x[i],&y[i]);
    memset(a,0,sizeof(a));
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)if(i!=j)
        if(sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))<=1.9999999999)a[i][j]=1;
    memset(used,0,sizeof(used));
    int ans=0;
    for(int i=0;i<n;i++)
         if(!used[i])ans=max(ans,dfs(i));
    cout<<ans<<endl;
  }
}