#include <bits/stdc++.h>
using namespace std;
void q90() {
  int n;
  for (; cin >> n;) {
    if (!n) break;
    vector<pair<double, double> > seals;
    for (int i = 0; i < n; i++) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      seals.push_back(make_pair(x, y));
    }
    int max = 0;
    for (auto i = seals.begin(); i != seals.end(); i++) {
      int overlap = 0;
      for (auto j = seals.begin(); j != seals.end(); j++) {
        if (pow((*i).first - (*j).first, 2) +
                pow((*i).second - (*j).second, 2) <=
            4.0) {
          overlap++;
        }
      }
      if (max < overlap) {
        max = max + overlap;
        overlap = max - overlap;
        max = max - overlap;
      };
    }
    cout << max << endl;
  }
}
int main() {
  q90();
  return 0;
}
