#include <bits/stdc++.h>
using namespace std;
const double eps = 1.0e-10;
complex<double> points[210];
int main(void) {
  int n;
  while (cin >> n, n) {
    for (int(i) = (0); (i) < (n); (i)++) {
      double x, y;
      char tmp;
      cin >> x >> tmp >> y;
      points[i] = {x, y};
    }
    int ans = 0;
    for (int(i) = (0); (i) < (n); (i)++) {
      int cur = 0;
      for (int(j) = (0); (j) < (n); (j)++)
        if (abs(points[i] - points[j]) < 2.0 - eps) cur++;
      ans = max(ans, cur);
    }
    cout << ans << endl;
  }
  return 0;
}
