#include <bits/stdc++.h>
using namespace std;
double x[110], y[110];
int overlap[110][110], t[110];
double sqr(double x) { return x * x; }
double dist(double x, double y, double xx, double yy) {
  return sqrt(sqr(x - xx) + sqr(y - yy));
}
int main() {
  int n;
  while (~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)
      for (int j = (0); j < (n); ++j)
        overlap[i][j] = (dist(x[i], y[i], x[j], y[j]) + 1e-12 <= 2) ? 1 : 0;
    int res = 0;
    for (int i = (0); i < (n); ++i) {
      for (int j = (0); j < (n); ++j) t[j] = overlap[i][j];
      for (int j = (0); j < (n); ++j)
        if (overlap[i][j])
          for (int k = (0); k < (n); ++k) t[k] &= overlap[j][k];
      int c = 0;
      for (int j = (0); j < (n); ++j) c += t[j];
      if (res < c) res = c;
    }
    printf("%d\n", res);
  }
  return 0;
}
