#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);
int n;
complex<double> point[200];
pair<double, int> radian[1000];
bool used[1000];
int calc(int index) {
  int m = 0;
  for (int i = 0; i < (int)(n); i++) {
    double d = abs(point[index] - point[i]) / 2.0;
    if (i == index || d - 1.0 > EPS) {
      continue;
    }
    complex<double> center = (point[index] - point[i]) / 2.0;
    complex<double> vect = (point[i] - point[index]) * complex<double>(0, -1);
    vect /= abs(vect);
    double l = sqrt(1 - d * d);
    if (isnan(l)) {
      l = EPS;
    }
    complex<double> c1 = center + vect * l;
    complex<double> c2 = center - vect * l;
    double arg1 = arg(c1 - point[index]) - EPS;
    double arg2 = arg(c2 - point[index]) + EPS;
    radian[m++] = make_pair(arg1, (i + 1));
    radian[m++] = make_pair(arg2, -(i + 1));
  }
  sort(radian, radian + m);
  memset((used), false, sizeof(used));
  int lsum = 1;
  int ret = 1;
  for (int iter = 0; iter < (int)(2); iter++) {
    for (int i = 0; i < (int)(m); i++) {
      int p = abs(radian[i].second) - 1;
      bool start = radian[i].second > 0 ? true : false;
      if (start) {
        used[p] = true;
        lsum++;
      } else if (used[p]) {
        used[p] = false;
        lsum--;
      }
      ret = max(ret, lsum);
    }
  }
  return ret;
}
int main() {
  while (scanf("%d", &n), n) {
    for (int i = 0; i < (int)(n); i++) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      point[i] = complex<double>(x, y);
    }
    int ans = 1;
    for (int i = 0; i < (int)(n); i++) {
      ans = max(ans, calc(i));
    }
    printf("%d\n", ans);
  }
}
