#include<complex>
#include<cmath>
#include<iostream>
#include<cstdio>
#define EPF 1e-10
#define PI 3.14159265358979323846264338
using namespace std;

typedef complex<double> P;

int main(){
  int n,ans;
  double x,y;
  while(cin >> n && n){
    P inf[n];
    ans = 1;
    for(int i=0;i<n;i++){
      scanf("%lf,%lf",&x,&y);
      inf[i] = P(x,y);
    }

    int cnt;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(abs(inf[i]-inf[j]) >= 2.0+EPF)continue;
	double MD = sqrt(1-0.25*norm(inf[i]-inf[j]));
	P mid = (inf[i]+inf[j])*0.5;
	P p1 = mid + (inf[i]-inf[j])/abs(inf[i]-inf[j])*polar(MD,M_PI/2);
	P p2 = mid + (inf[i]-inf[j])/abs(inf[i]-inf[j])*polar(MD,-M_PI/2);
	cnt = 0;
	for(int k=0;k<n;k++)if(abs(p1-inf[k]) < EPF+1.0)cnt++;
	
	ans = ans<cnt?cnt:ans;
	cnt = 0;
	for(int k=0;k<n;k++)if(abs(p2-inf[k]) < EPF + 1.0)cnt++;
	ans = ans<cnt?cnt:ans;
      }
    }
    cout << ans << endl;
  }
  return 0;
}