#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  char c;
  while (cin >> n, n) {
    double x[200], y[200];
    int ans = 1, pre;
    for (int i = 0; i < n; i++) cin >> x[i] >> c >> y[i];
    for (int i = 0; i < n; i++) {
      pre = 0;
      for (int j = 0; j < n; j++)
        if ((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) <=
            4) {
          pre++;
        }
      ans = max(pre, ans);
    }
    cout << ans << endl;
  }
  return 0;
}
