#include <bits/stdc++.h>
using namespace std;
int main(void) {
  vector<pair<double, double> > in;
  vector<pair<double, double> > v;
  int n;
  while (1) {
    int max = 1;
    scanf("%d", &n);
    if (!n) break;
    for (int i = 0; i < n; i++) {
      pair<double, double> tmp;
      scanf("%lf,%lf", &tmp.first, &tmp.second);
      in.push_back(tmp);
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        double theta, phi;
        double sqr_d;
        if (i == j) continue;
        sqr_d = ((in[i].first - in[j].first) * (in[i].first - in[j].first)) +
                ((in[i].second - in[j].second) * (in[i].second - in[j].second));
        if (sqr_d > 4) continue;
        theta = acos(sqr_d / (2 * sqrt(sqr_d)));
        phi = atan2(in[j].second - in[i].second, in[j].first - in[i].first);
        v.push_back(pair<double, double>(in[i].first + cos(phi + theta),
                                         in[i].second + sin(phi + theta)));
        v.push_back(pair<double, double>(in[i].first + cos(phi - theta),
                                         in[i].second + sin(phi - theta)));
      }
    }
    for (int i = 0; i < v.size(); i++) {
      int tmp = 0;
      for (int j = 0; j < n; j++) {
        double sqr_d;
        sqr_d = ((v[i].first - in[j].first) * (v[i].first - in[j].first)) +
                ((v[i].second - in[j].second) * (v[i].second - in[j].second));
        if (sqr_d <= 1) tmp++;
      }
      if (tmp > max) max = tmp;
    }
    printf("%d\n", max);
  }
  return 0;
}
