#include <algorithm>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <utility>
#include <vector>

using namespace std;

typedef pair<double, double> Center;

bool overlaps(const Center& a, const Center& b) {
  double squared_distance =
    pow(a.first - b.first, 2.0) + pow(a.second - b.second, 2.0);
  return squared_distance < 2.0 * 2.0;
}

int main() {
  while (true) {
    int n;
    scanf("%d", &n);
    if (n == 0) { break; }

    bool overlap_matrix[100][100] = {};
    vector<Center> circles;
    for (int i = 0; i < n; ++i) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      circles.emplace_back(x, y);
    }

    for (int i = 0; i < circles.size(); ++i) {
      for (int j = i; j < circles.size(); ++j) {
        if (overlaps(circles[i], circles[j])) {
          overlap_matrix[i][j] = overlap_matrix[j][i] = true;
        }
      }
    }

    int max_overlaps = 0;
    for (int i = 0; i < circles.size(); ++i) {
      max_overlaps = max(max_overlaps,
                         accumulate(overlap_matrix[i],
                                    overlap_matrix[i] + n,
                                    0, [&](int acc, bool overlaps) {
                                      return acc + (overlaps ? 1 : 0);
                                    }));
    }
    printf("%d\n", max_overlaps);
  }

  return 0;
}