#include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int n;
    cin >> n;
    if (!n) break;
    vector<pair<double, double> > v(n);
    for (int i = (0); i < (n); i++) {
      double a, b;
      scanf("%lf,%lf", &a, &b);
      v[i] = pair<double, double>(a, b);
    }
    int ans = 0;
    double x1, x2, y1, y2;
    for (int i = (0); i < (n); i++) {
      x1 = v[i].first;
      y1 = v[i].second;
      int maxer = 0;
      for (int j = (0); j < (n); j++) {
        x2 = v[j].first;
        y2 = v[j].second;
        double d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
        if (d - 4.0 < (1e-8)) maxer++;
      }
      ans = max(ans, maxer);
    }
    cout << ans << endl;
  }
  return 0;
}
