#include <bits/stdc++.h>
struct P {
  double x, y;
};
std::pair<P, P> cross(std::pair<P, double> a, std::pair<P, double> b) {
  std::pair<P, P> ret;
  ret.first.x = -100000;
  double x = a.first.x - b.first.x;
  double y = a.first.y - b.first.y;
  double l = std::sqrt(x * x + y * y);
  if (l > a.second + b.second) return ret;
  double c = std::atan2(b.first.y - a.first.y, b.first.x - a.first.x);
  double alpha = std::acos((l * l + a.second * a.second - b.second * b.second) /
                           (2 * l * a.second));
  P r1, r2;
  r1.x = a.first.x + std::cos(c + alpha),
  r1.y = a.first.y + std::sin(c + alpha);
  r2.x = a.first.x + std::cos(c - alpha),
  r2.y = a.first.y + std::sin(c - alpha);
  ret.first = r1;
  ret.second = r2;
  return ret;
}
bool check(std::pair<P, double> cir, P p) {
  double l = (cir.first.x - p.x) * (cir.first.x - p.x) +
             (cir.first.y - p.y) * (cir.first.y - p.y);
  l = std::sqrt(l);
  return (l <= cir.second);
}
int main() {
  int n;
  while (std::cin >> n, n) {
    int res = 1;
    std::pair<P, double> data[1001];
    std::vector<P> search;
    for (int i = 0; i < n; i++) {
      double x, y, r;
      scanf("%lf,%lf", &x, &y);
      P p;
      p.x = x;
      p.y = y;
      data[i] = std::pair<P, double>(p, 1);
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        std::pair<P, P> ret = cross(data[i], data[j]);
        if (ret.first.x != -100000)
          search.push_back(ret.first), search.push_back(ret.second);
      }
    }
    for (int i = 0; i < search.size(); i++) {
      int cnt = 0;
      for (int j = 0; j < search.size(); j++) {
        cnt += check(data[j], search[i]);
      }
      res = std::max(res, cnt);
    }
    std::cout << res << std::endl;
  }
  return 0;
}
