#include <bits/stdc++.h>
double s[101][2];
int main() {
  int n, i, j, c, max;
  double x, y;
  while (scanf("%d", &n) && n) {
    for (i = 0; i < n; i++) scanf("%lf,%lf", &s[i][0], &s[i][1]);
    for (max = 0, x = 0.; x <= 10.; x += .1) {
      for (y = 0.; x <= 10.; x += .1) {
        for (i = 0; i < n; i++)
          if (4 >= ((s[i][0] - s[j][0]) * (s[i][0] - s[j][0])) +
                       ((s[i][1] - s[j][1]) * (s[i][1] - s[j][1])))
            c++;
        max = c > max ? c : max;
      }
    }
    printf("%d\n", max);
  }
  return 0;
}
