#include <bits/stdc++.h>
using namespace std;
double x[100], y[100];
bitset<100> bits[100];
int main() {
  int n;
  while (true) {
    scanf("%d", &n);
    if (n == 0) break;
    for (int i = 0; i < n; ++i) scanf("%lf,%lf", &x[i], &y[i]);
    for (int i = 0; i < n; ++i) bits[i].reset();
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        double d =
            (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
        if (d <= 4.0000000001) bits[i][j] = 1;
      }
    }
    int res = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = i; j < n; ++j)
        if (bits[i][j]) bits[i] &= bits[j];
      if (res < bits[i].count()) res = bits[i].count();
    }
    printf("%d\n", res);
  }
  return 0;
}
