#include <bits/stdc++.h>
using namespace std;
int func(bool a[101][101], bool vis[101], int n, int s) {
  int c = 1;
  vis[s] = false;
  for (int i = 0; i < n; i++) {
    if (a[s][i] && i != s && vis[i]) {
      c += func(a, vis, n, i);
    }
  }
  return c;
}
int main() {
  int n, s, t;
  double x[101], y[101], r;
  bool a[101][101], vis[101];
  while (1) {
    cin >> n;
    if (n == 0) {
      break;
    }
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x[i], &y[i]);
    }
    fill(vis, vis + n, true);
    fill(&a[0][0], &a[n][n], false);
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        r = sqrt((((x[i] - x[j]) * (x[i] - x[j])) +
                  ((y[i] - y[j]) * (y[i] - y[j]))));
        if (2.0 >= r) {
          a[i][j] = a[j][i] = true;
        }
      }
    }
    t = 0;
    for (int i = 0; i < n; i++) {
      if (vis[i]) {
        s = func(a, vis, n, i);
        if (s > t) {
          t = s;
        }
      }
    }
    cout << t << endl;
  }
  return 0;
}
