#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
bool solve() {
  int n;
  double x[100], y[100];
  vector<pair<double, double> > vec;
  scanf("%d", &n);
  if (n == 0) return false;
  for (int i = 0; i < n; i++) {
    scanf("%lf,%lf", x + i, y + i);
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      double dx = x[j] - x[i];
      double dy = y[j] - y[i];
      if (dx * dx + dy * dy <= 4 + eps) {
        double a = (dx * dx + dy * dy + 1 - 1) / 2;
        double cx1 = (a * dx + dy * sqrt((dx * dx + dy * dy) - a * a)) /
                     (dx * dx + dy * dy);
        double cy1 = (a * dy - dx * sqrt((dx * dx + dy * dy) - a * a)) /
                     (dx * dx + dy * dy);
        double cx2 = (a * dx - dy * sqrt((dx * dx + dy * dy) - a * a)) /
                     (dx * dx + dy * dy);
        double cy2 = (a * dy + dx * sqrt((dx * dx + dy * dy) - a * a)) /
                     (dx * dx + dy * dy);
        vec.push_back({cx1 + x[i], cy1 + y[i]});
        vec.push_back({cx2 + x[i], cy2 + y[i]});
      }
    }
  }
  int ans = 1;
  for (int i = 0; i < vec.size(); i++) {
    int counter = 0;
    for (int j = 0; j < n; j++) {
      double dx = x[j] - vec[i].first;
      double dy = y[j] - vec[i].second;
      if (dx * dx + dy * dy <= 1 + eps) {
        counter++;
      }
    }
    ans = max(ans, counter);
  }
  printf("%d\n", ans);
  return 0;
}
int main() {
  while (solve())
    ;
}
