#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
int main() {
  int n;
  while (~scanf("%d", &n)) {
    if (n == 0) break;
    vector<pair<double, double> > p(n);
    for (int i = 0; i < n; ++i) scanf("%lf,%lf", &p[i].first, &p[i].second);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      int cnt = 1;
      for (int j = 0; j < n; ++j) {
        if (i == j) continue;
        double xx = p[i].first - p[j].first;
        double yy = p[i].second - p[j].second;
        if (xx * xx + yy * yy - 4.0 < EPS) ++cnt;
      }
      ans = max(ans, cnt);
    }
    printf("%d\n", ans);
  }
  return 0;
}
