#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int i, j;
  double eps = 1e-10;
  while (1) {
    int n;
    cin >> n;
    if (n == 0) break;
    vector<double> x(n), y(n);
    for (i = 0; i < n; ++i) scanf(" %lf,%lf", &x[i], &y[i]);
    int ans = 0;
    for (i = 0; i < n; ++i) {
      int tmp = 0;
      for (j = 0; j < n; ++j) {
        double dist = pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2);
        if (dist < 4.0 - eps) ++tmp;
      }
      ans = max(ans, tmp);
    }
    std::cout << ans << std::endl;
  }
  return 0;
}
