#include <bits/stdc++.h>
using namespace std;
int main(void) {
  vector<pair<double, double>> point;
  vector<vector<pair<double, double>>> overlap;
  int count[100];
  int n;
  while (1) {
    overlap.clear();
    for (int f1 = 0; f1 < 100; f1++) {
      count[f1] = 0;
    }
    point.clear();
    scanf("%d", &n);
    if (n == 0) {
      break;
    }
    for (int f1 = 0; f1 < n; f1++) {
      pair<double, double> p;
      scanf("%lf,%lf", &p.first, &p.second);
      point.push_back(p);
    }
    for (int f1 = 0; f1 < n; f1++) {
      overlap.push_back(vector<pair<double, double>>());
      (overlap.end() - 1)->push_back(point[f1]);
      for (int f2 = f1 + 1; f2 < n; f2++) {
        double x, y, r;
        x = point[f1].first - point[f2].first;
        y = point[f1].second - point[f2].second;
        r = 2;
        if (x * x + y * y <= r * r) {
          (overlap.end() - 1)->push_back(point[f2]);
        }
      }
    }
    for (int f1 = 0; f1 < overlap.size(); f1++) {
      count[f1] = overlap[f1].size();
      for (int f2 = 0; f2 < overlap[f1].size(); f2++) {
        for (int f3 = f2 + 1; f3 < overlap[f1].size(); f3++) {
          double x, y, r;
          x = overlap[f1][f2].first - overlap[f1][f3].first;
          y = overlap[f1][f2].second - overlap[f1][f3].second;
          r = 2;
          if (x * x + y * y > r * r) {
            count[f1]--;
            break;
          }
        }
      }
    }
    int maxi = 0;
    for (int f1 = 0; f1 < 100; f1++) {
      if (count[f1] > maxi) {
        maxi = count[f1];
      }
    }
    printf("%d\n", maxi);
  }
  return 0;
}
