#include <bits/stdc++.h>
struct StdDataset {
  double x;
  double y;
};
void mystrtod(char *str, double *x, double *y) {
  char *ends;
  char *str_x;
  char *str_y;
  str_x = strtok(str, ",");
  str_y = strtok(NULL, ",");
  *x = strtod(str_x, &ends);
  *y = strtod(str_y, &ends);
}
double dist(double a1, double a2, double b1, double b2) {
  double a = 0;
  double b = 0;
  double dist = 0;
  if (a1 > a2) {
    a = a1 - a2;
  } else {
    a = a2 - a1;
  }
  if (b1 > b2) {
    b = b1 - b2;
  } else {
    b = b2 - b1;
  }
  dist = sqrt(pow(a, 2) + pow(b, 2));
  return dist;
}
void overlaps(int n) {
  int i, j, k;
  int ans;
  int wk_ans;
  char str[20];
  double wk_x;
  double wk_y;
  double wk_dist;
  struct StdDataset dset[n];
  printf("\nType the dataset >>>\n");
  for (i = 0; i < n; i++) {
    scanf("%s", str);
    mystrtod(str, &wk_x, &wk_y);
    if (10 < wk_x || 0 > wk_x || 10 < wk_y || 0 > wk_y) {
      printf(
          "\nError!\nThe value of X and Y must be 0 or more and 10 or "
          "less.\nPlease "
          "retype.\n");
      i--;
    } else {
      dset[i].x = wk_x;
      dset[i].y = wk_y;
    }
  }
  ans = 1;
  wk_dist = 0;
  if (1 >= n) {
  } else {
    for (j = 0; j < n - 1; j++) {
      wk_ans = 1;
      for (k = j + 1; k < n; k++) {
        wk_dist = dist(dset[j].x, dset[k].x, dset[j].y, dset[k].y);
        if (2 >= wk_dist) {
          wk_ans++;
        } else {
        }
      }
      if (wk_ans > ans) {
        ans = wk_ans;
      } else {
      }
    }
  }
  printf("%d", ans);
  printf("\n");
}
int main(int argc, const char *argv[]) {
  int max_n;
  printf("\nType the number of datasets (or '0' when done) >>>\n");
  scanf("%d", &max_n);
  while (0 != max_n) {
    if (100 < max_n) {
      printf("\nError!\nThe value of N must be 100 or less.\n");
      return -1;
    } else {
      overlaps(max_n);
      printf("\nType the number of datasets (or '0' when done) >>>\n");
      scanf("%d", &max_n);
    }
  }
  return 0;
}
