#include <bits/stdc++.h>
int calc_overlap(float* xs, float* ys, int n) {
  int i;
  int max_counts = 1;
  int counts;
  for (i = 0; i < 10; i++) {
    int j;
    for (j = 0; j < 10; j++) {
      counts = -1;
      int k;
      for (k = 0; k < n; k++) {
        float distance = (i - xs[k]) * (i - xs[k]) + (j - ys[k]) * (j - ys[k]);
        if (distance <= 4.0) {
          counts++;
        }
      }
      if (counts > max_counts) {
        max_counts = counts;
      }
    }
  }
  return max_counts;
}
int main(int argc, char const* argv[]) {
  while (true) {
    int n;
    scanf("%d", &n);
    if (n == 0) {
      return 0;
    }
    char buf[256] = {};
    float xs[100] = {};
    float ys[100] = {};
    int i;
    for (i = 0; i < n; i++) {
      scanf("%f,%f", &xs[i], &ys[i]);
    }
    int pos = calc_overlap(xs, ys, n);
    printf("%d\n", pos);
  }
  return 0;
}
