#include <bits/stdc++.h>
using namespace std;
struct P {
  double x, y;
};
const double EPS = 1e-15;
vector<P> cross(P a, P b) {
  vector<P> ret;
  double x = a.x - b.x, y = a.y - b.y;
  double L = x * x + y * y;
  if (L > 4.0) return ret;
  L = sqrt(L);
  double C = atan2(b.y - a.y, b.x - a.x);
  double co = L / 2;
  double alpha = acos(co);
  P r1, r2;
  r1.x = a.x + cos(C + alpha), r1.y = a.y + sin(C + alpha);
  r2.x = a.x + cos(C - alpha), r2.y = a.y + sin(C - alpha);
  ret.push_back(r1);
  if (r1.x != r2.x || r1.y != r2.y) ret.push_back(r2);
  return ret;
}
bool check(P cir, P pt) {
  cir.x -= pt.x, cir.y -= pt.y;
  return (cir.x * cir.x + cir.y * cir.y) <= 1 + EPS;
}
int main() {
  int n;
  while (scanf("%d", &n), n) {
    int ret = 0;
    vector<P> data(n);
    vector<P> search;
    for (int i = 0; i < n; i++) scanf("%lf,%lf\n", &data[i].x, &data[i].y);
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        vector<P> get = cross(data[i], data[j]);
        for (int k = 0; k < get.size(); k++) {
          search.push_back(get[k]);
        }
      }
    }
    for (int i = 0; i < search.size(); i++) {
      int count = 0;
      for (int j = 0; j < n; j++) {
        count += check(data[j], search[i]);
      }
      ret = max(ret, count);
    }
    cout << ret << endl;
  }
}
