#include <bits/stdc++.h>
using namespace std;
void intrsc(const pair<double, double> point, &c1,
            const pair<double, double> point, &c2, vector<point> &v) {
  double a, b, c, d, e, f, g, D;
  double x1, x2, y1, y2, ix1, ix2, iy1, iy2;
  x1 = c1.first;
  x2 = c2.first;
  y1 = c1.second;
  y2 = c2.second;
  a = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
  b = 2.0 * (y1 - y2);
  c = 2.0 * (x1 - x2);
  d = b * b + c * c;
  e = b * c * y1 - a * c - b * b * x1;
  f = b * b * (x1 * x1 + y1 * y1 - 1.0) + a * a - 2 * a * b * y1;
  D = e * e - d * f;
  if (D >= 0) {
    if (abs(d) < 1e-9) {
      v.push_back(point(x1 + 1.0, y1));
      return;
    }
    g = sqrt(D);
    ix1 = (-e + g) / d;
    ix2 = (-e - g) / d;
    if (abs(b) < 1e-9) {
      iy1 = sqrt(1.0 - (ix1 - x1) * (ix1 - x1));
      iy2 = y1 - iy1;
      iy1 += y1;
    } else {
      iy1 = (a - c * ix1) / b;
      iy2 = (a - c * ix2) / b;
    }
    v.push_back(point(ix1, iy1));
    v.push_back(point(ix2, iy2));
  }
}
inline bool in(const point &p, const pair<double, double> point, &c) {
  return (p.first - c.first) * (p.first - c.first) +
             (p.second - c.second) * (p.second - c.second) <=
         1.0 + 1e-9;
}
int main() {
  int n;
  double x, y;
  for (; scanf("%d", &n), n;) {
    vector<point> v;
    vector<pair<double, double> point, > crcl(n);
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x, &y);
      crcl[i] = pair<double, double> point, (x, y);
    }
    for (int i = 0; i < n - 1; i++)
      for (int j = i + 1; j < n; j++) intrsc(crcl[i], crcl[j], v);
    int m = 0;
    for (vector<point>::iterator p_it = v.begin(); p_it != v.end(); ++p_it) {
      int cnt = 0;
      for (vector<pair<double, double> point, >::iterator it = crcl.begin();
           it != crcl.end(); ++it) {
        if (in(*p_it, *it)) cnt++;
      }
      m = max(m, cnt);
    }
    printf("%d\n", m);
  }
}
