#include <bits/stdc++.h>
using namespace std;
const double K = 0.008;
double x[105], y[105];
int n;
double calc_dist(int id, double s, double t) {
  return sqrt((x[id] - s) * (x[id] - s) + (y[id] - t) * (y[id] - t));
}
int count(double s, double t) {
  int res = 0;
  for (int i = 0; i < n; i++) {
    if (calc_dist(i, s, t) <= 1.0 + 1e-9) res++;
  }
  return res;
}
int main() {
  while (1) {
    cin >> n;
    if (n == 0) break;
    int ans = 1;
    memset(x, 0, sizeof(x));
    memset(y, 0, sizeof(y));
    for (int i = 0; i < n; i++) scanf("%lf,%lf", &x[i], &y[i]);
    for (double i = 0.0; i <= 10.0; i += K) {
      for (double j = 0.0; j <= 10.0; j += K) {
        ans = max(ans, count(i, j));
      }
    }
    cout << ans << endl;
  }
  return 0;
}
