#include <bits/stdc++.h>
using namespace std;
int main() {
  double eps = 10e-7;
  double x, y;
  int n;
  while (~scanf("%d", &n)) {
    if (n == 0) break;
    vector<pair<double, double> > base;
    int res = 0;
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x, &y);
      base.push_back(pair<double, double>(x, y));
    }
    for (int i = 0; i < base.size(); i++) {
      int c = 1;
      for (int j = 0; j < base.size(); j++) {
        if (i == j) continue;
        double dist = sqrt(pow((base[i].first - base[j].first), 2.0) +
                           pow((base[i].second - base[j].second), 2.0));
        if (dist <= 2.0) {
          c++;
        }
      }
      res = max(res, c);
    }
    cout << res << endl;
  }
}
