#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <complex>

#include <string>
#include <sstream>
using namespace std;

typedef complex<double> P;

struct C {
  P p;
  double r;
  C(P p, double r) : p(p), r(r) {}
};

const double eps = 1e-10;
const double pi = acos(-1);


double equals(double a, double b) { return fabs(a-b) < eps; }

double dot(P a, P b) { return a.real()*b.real() + a.imag()*b.imag(); }
double norm(P a) { return dot(a,a); }
double abs(P a) { return sqrt(norm(a)); }

bool isIn(P p, C c) {
  double d = norm(p-c.p);
  double rr = c.r*c.r;
  return equals(d, rr) || d < rr;
}

P getRotateP(P a, double rad) {
  return P(a.real()*cos(rad) - a.imag()*sin(rad),
	   a.real()*sin(rad) + a.imag()*cos(rad));
}

int isIntersect(C a, C b) {
  double d = norm(a.p-b.p);
  double rpr = a.r + b.r;
  double rmr = a.r - b.r;
  rpr *= rpr; rmr *= rmr;
  if(equals(d,rpr)) return 1;//circumscribed
  if(equals(d,rmr)) return 1;//inscribed
  if(d > rpr) return 0;
  if(d < rmr) return 0;
  return 2;
}

vector<P> getCrossP(C a, C b) {
  vector<P> v;
  int num = isIntersect(a,b);
  P base = b.p - a.p;
  if(num == 1) {
    v.push_back(a.p + base*a.r/abs(b.p - a.p));
  } else if(num == 2) {
    double drad = acos((norm(base) + a.r*a.r - b.r*b.r)/(2.0*abs(base)*a.r));
    v.push_back(a.p + getRotateP(base, drad)*a.r/abs(base));
    v.push_back(a.p + getRotateP(base, drad)*a.r/abs(base));
  }
  return v;
}

vector<C> seal;
vector<P> ps;

void makeIP() {
  for(int i = 0; i < seal.size(); ++i) {
    for(int j = i+1; j < seal.size(); ++j) {
      vector<P> v = getCrossP(seal[i], seal[j]);
      for(int k = 0; k < v.size(); ++k) ps.push_back(v[k]);
    }
  }
}

int solve() {
  ps.clear();
  makeIP();
  for(int i = 0; i < seal.size(); ++i)
    ps.push_back(seal[i].p);

  int res = 1;
  for(int i = 0; i < ps.size(); ++i) {
    int cnt = 0;
    for(int j = 0; j < seal.size(); ++j) {
      if(isIn(ps[i], seal[j])) ++cnt;
    }
    res = max(res, cnt);
  }
  return res;
}

int main() {
  int n;
  while(cin >> n && n) {
    getchar();
    seal.clear();
    for(int i = 0; i < n; ++i) {
      string line;
      stringstream ss;
      getline(cin, line);
      replace(line.begin(), line.end(), ',', ' ');
      ss << line;
      P p;
      ss >> p.real() >> p.imag();
      seal.push_back(C(p, 1.0));
    }
    cout << solve() << endl;
  }
  return 0;
}