#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

#define Sq(x) ((x)*(x))
#define F first
#define S second
#define EPS (1e-5)

typedef pair<double, double> Pdd;

inline double dist2(Pdd a, Pdd b) { return Sq(a.F-b.F)+Sq(a.S-b.S); }
inline double dist(Pdd a, Pdd b)  { return sqrt(dist2(a, b)); }

int main() {
  int n;
  
  while(cin >> n && n) {
    vector<Pdd> c(n);
    char ch;
    for(int i=0; i<n; i++)
      cin >> c[i].F >> ch >> c[i].S;
    
    vector<pair<Pdd, Pdd> > p;
    for(int i=0; i<n-1; i++) {
      for(int j=i+1; j<n; j++) {
	if( dist2(c[i], c[j]) <= 4.0 + EPS ) {
	  double xc = ( c[i].F+c[j].F ) / 2;
	  double yc = ( c[i].S+c[j].S ) / 2;
	  double a = dist(c[i], c[j]) / 2;
	  double len = sqrt(1.0 - a*a);
	  
	  double vlen = sqrt(Sq(c[i].F - xc) + Sq(c[i].S - yc));
	  if(vlen == 0) continue;
	  
	  double v1x = len*(c[i].F - xc)/vlen;
	  double v1y = len*(c[i].S - yc)/vlen;
	  Pdd p1(xc-v1y, yc+v1x);
	  Pdd p2(xc+v1y, yc-v1x);
	  p.push_back(make_pair(p1, p2));
	}
      }
    }
    
    int N = p.size();
    int res = 0;
    for(int i=0; i<N; i++) {
      Pdd p1 = p[i].F, p2 = p[i].S;
      int cnt = 0;
      for(int i=0; i<n; i++) {
	if(dist2(p1, c[i]) <= 4.0 + EPS && dist2(p2, c[i]) <= 4.0 + EPS)
	  cnt ++;
      }
      res = max(res, cnt);
    }
    
    cout << res << endl;
  }
  
  return 0;
}