#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int i, j;
  double eps = 1e-15;
  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 (double X = 0; X <= 10; X += 0.01) {
      for (double Y = 0; Y <= 10; Y += 0.01) {
        int tmp = 0;
        for (i = 0; i < n; ++i) {
          if (pow(X - x[i], 2) + pow(Y - y[i], 2) < 1.0 + eps) ++tmp;
        }
        ans = max(ans, tmp);
      }
    }
    std::cout << ans << std::endl;
  }
  return 0;
}
