#include <bits/stdc++.h>
int main(void) {
  int num_data;
  double data[100][2];
  int i, j, k, count1, count2, max_overlap;
  double x1, y1, x2, y2, x3, y3, c1x, c1y, c2x, c2y;
  double distance, th, al;
  scanf("%d", &num_data);
  for (i = 0; i < num_data; i++) {
    scanf("%lf,%lf", data[i], data[i] + 1);
  }
  scanf("%d", &i);
  max_overlap = 0;
  for (i = 0; i < num_data; i++) {
    x1 = data[i][0];
    y1 = data[i][1];
    for (j = 0; j < num_data; j++) {
      if (i == j) continue;
      x2 = data[j][0];
      y2 = data[j][1];
      distance = hypot(x2 - x1, y2 - y1);
      if (distance <= 2.0) {
        if (x1 == x2 && y1 == y2) {
          c1x = c2x = x1;
          c1y = c2y = y1;
        } else {
          th = atan2(y2 - y1, x2 - x1);
          al = acos((distance * distance) / (distance * 2.0));
          c1x = x1 + cos(th + al);
          c1y = y1 + sin(th + al);
          c2x = x1 + cos(th - al);
          c2y = y1 + sin(th - al);
        }
        count1 = count2 = 0;
        for (k = 0; k < num_data; k++) {
          x3 = data[k][0];
          y3 = data[k][1];
          if (hypot(c1x - x3, c1y - y3) <= 1.0) {
            count1 += 1;
          }
          if (hypot(c2x - x3, c2y - y3) <= 1.0) {
            count2 += 1;
          }
        }
        if (max_overlap < count1) {
          max_overlap = count1;
        }
        if (max_overlap < count2) {
          max_overlap = count2;
        }
      }
    }
  }
  printf("%d\n", max_overlap);
  return 0;
}
