#include <bits/stdc++.h>
using namespace std;
int area[11000][110];
int atop[11000];
double x[110], y[110];
bool isover(int a, int b) {
  double d = (x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]);
  if (d <= 4.0)
    return true;
  else
    return false;
}
int main() {
  int n, top;
  while (true) {
    cin >> n;
    if (n == 0) break;
    top = 0;
    char z;
    for (int i = 0; i < n; i++) {
      cin >> x[i] >> z >> y[i];
      for (int j = 0; j < top; j++) {
        bool ok = true;
        for (int k = 0; k < atop[j]; k++) {
          if (isover(i, area[j][k]) == false) {
            ok = false;
          }
          if (i == area[j][k]) ok = false;
        }
        if (ok) {
          for (int k = 0; k < atop[j]; k++) {
            area[top][k] = area[j][k];
          }
          area[top][atop[j]] = i;
          atop[top] = atop[j] + 1;
          top++;
        }
      }
      area[top][0] = i;
      atop[top] = 1;
      top++;
    }
    int ans = 0;
    for (int i = 0; i < top; i++) {
      ans = max(ans, atop[i]);
    }
    cout << ans << endl;
  }
  return 0;
}
