#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];
bool vis[101];
int dfs(int x,int d){
  int res=1;
  vis[x]=1;
  for(int i=x+1;i<n;i++){
    if(a[x][i]<=2&&(!vis[i])){
      if(!d)res=max(res,dfs(i,d+1)+1);
      else res+=dfs(i,d);
    }
  }
  return res;
}
int main(){
  while(cin>>n,n){
    r(i,n)scanf("%lf,%lf",&x[i],&y[i]);
    memset(a,0,sizeof(a));
    r(i,n)for(int j=i+1;j<n;j++)a[i][j]=a[j][i]=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
    int ans=0;
    r(i,n){
      if(ans>=n-i)break;
      memset(vis,0,sizeof(vis));
      ans=max(ans,dfs(i,0));
    }
    cout<<ans<<endl;
  }
}