#include <bits/stdc++.h>
using namespace std;
bool overlaps(const pair<double, double>& a, const pair<double, double>& b) {
  double squared_distance = (a.first - b.first) * (a.first - b.first) +
                            (a.second - b.second) * (a.second - b.second);
  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];
    for (int i = 0; i < 100; ++i) {
      fill(overlap_matrix[i], overlap_matrix[i] + 100, false);
    }
    vector<pair<double, double> > 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 < n; ++i) {
      for (int j = i; j < n; ++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 < n; ++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;
}
