#include <bits/stdc++.h>
using namespace std;
double dis(double xa, double ya, double xb, double yb) {
  return sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
}
int main() {
  int n;
  while (cin >> n, n) {
    vector<double> X(n), Y(n);
    for (int i = 0; i < n; i++) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      X[i] = x;
      Y[i] = y;
    }
    vector<int> cnt(n, 1);
    for (int i = 0; i < n - 1; i++) {
      for (int j = i + 1; j < n; j++) {
        if (2 - dis(X[i], Y[i], X[j], Y[j]) >= 0.00000) {
          cnt[i]++;
          cnt[j]++;
        }
      }
    }
    cout << *max_element(cnt.begin(), cnt.end()) << endl;
  }
}
