#include <iostream>
#include <cstdlib>
#include <vector>
#include <cstdio>
#include <algorithm>

#define EPS (1e-5)

using namespace std;


class Point{
public:
  double x, y;
  Point ( double x =0, double y=0): x(x), y(y){}
  Point operator + ( Point p ){ return Point(x + p.x, y + p.y); }
  Point operator - ( Point p ){ return Point(x - p.x, y - p.y); }
  Point operator * ( double a ){ return Point(a*x, a*y); }
  double abs() { return sqrt(norm());}
  double norm() { return x*x + y*y; }
  bool operator < ( const Point &p ) const{
    return x != p.x ? x < p.x : y < p.y;
  }
  bool operator == ( const Point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};
Point p[100];
int n;

vector<Point> cross(Point a, Point b){
  vector<Point> res;
  if(fabs((b-a).abs()-2.0)<EPS){
    Point c = a + b;
    res.push_back( Point(c.x/2.0, c.y/2.0) );
  }else if((b-a).abs()<2.0){
    Point ab = b - a;
    Point center = a + Point(ab.x/2.0,ab.y/2.0);
    Point un1 = Point(-ab.y/ab.abs(), ab.x/ab.abs());
    Point un2 = Point(ab.y/ab.abs(), -ab.x/ab.abs());
    double dist = sqrt(1.0 - pow(ab.abs() /2.0, 2.0));
    Point c1 = center + un1 * dist;
    Point c2 = center + un2 * dist;
    res.push_back(c1);
    res.push_back(c2);
  }
  return res;
}

int solve(){
  int ans=1;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      vector<Point> c=cross(p[i], p[j]);
      if(c.empty()) continue;
      int cnt1=2, cnt2=2;
      for(int k=0;k<n;k++){
	if(i==k || j==k) continue;
	if((c[0]-p[k]).abs()-1.0<EPS) cnt1++;
	if(c.size()==2 && (c[1]-p[k]).abs()-1.0<EPS) cnt2++;
      }
      ans=max(ans, max(cnt1, cnt2));
    }
  }
  return ans;
}
main(){
  while(1){
    cin >> n;
    if(n==0) break;
    for(int i=0;i<n;i++){
      cin >> p[i].x;
      getchar();
      cin >> p[i].y;
    }
    cout << solve() << endl;
  }
  return 0;
}