#include <bits/stdc++.h>
typedef struct seal {
  double x, y;
} seal_t;
seal_t seal(double x, double y) {
  seal_t t;
  t.x = x, t.y = y;
  return t;
}
int overlap(seal_t a, seal_t b) {
  double dist = sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
  return dist <= 2 * 1;
}
typedef struct list *list_t;
struct list {
  int val;
  list_t next;
};
list_t list(int val, list_t next) {
  list_t t = (list_t)malloc(sizeof(struct list));
  t->val = val, t->next = next;
  return t;
}
int length(list_t list) {
  if (!list) return 0;
  if (!list->next) return 1;
  return length(list->next) + 1;
}
int n, count;
seal_t seals[100];
void read() {
  int i;
  for (i = 0; i < n; i++) scanf("%lf,%lf", &(seals[i].x), &(seals[i].y));
}
void solve(int beg, list_t lst) {
  int i;
  list_t t;
  i = length(lst);
  if (i > count) count = i;
  for (i = beg; i < n; i++) {
    for (t = lst; t; t = t->next)
      if (!overlap(seals[i], seals[t->val])) break;
    if (!t) solve(i + 1, list(i, lst));
  }
  free(lst);
}
int main(void) {
  while (scanf("%d", &n), n) {
    read();
    count = 0;
    solve(0, NULL);
    printf("%d\n", count);
  }
  return 0;
}
