#include <bits/stdc++.h>
using namespace std;
int main() {
  double x[128], y[128];
  int n, i, j;
  for (;;) {
    cin >> n;
    if (n == 0) break;
    char a;
    int ans = 0;
    for (i = 0; i < n; i++) cin >> x[i] >> a >> y[i];
    for (i = 0; i < n; i++) {
      int s_ans = 1;
      for (j = 0; j < n; j++) {
        if (i != j && 2.0 >= sqrt((x[i] - x[j]) * (x[i] - x[j]) +
                                  (y[i] - y[j]) * (y[i] - y[j])))
          s_ans++;
      }
      if (ans < s_ans) ans = s_ans;
    }
    cout << ans << endl;
  }
}
