#include <bits/stdc++.h>
using namespace std;
class CPoint {
 public:
  CPoint(double x, double y) : x(x), y(y) {}
  double x, y;
};
double Distance(const CPoint &p1, const CPoint &p2) {
  return sqrt(pow(p2.x - p1.x, 2.0) + pow(p2.y - p1.y, 2.0));
}
class CSeal {
 public:
  CSeal(double x, double y) : p(x, y), r(1.0), overlapping(0) {}
  CPoint p;
  double r;
  unsigned int overlapping;
  bool isOverlapped(const CSeal &s) {
    if (s.r + r >= Distance(s)) return true;
    return false;
  }
  double Distance(const CSeal &s) { return ::Distance(p, s.p); }
};
int main(void) {
  while (true) {
    int n;
    unsigned int maxOverlapped = 0;
    vector<CSeal> vSeals;
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      double x, y;
      cin >> x;
      cin.ignore(1);
      cin >> y;
      CSeal tmp(x, y);
      vSeals.push_back(tmp);
    }
    for (unsigned int i = 0; i < vSeals.size(); i++) {
      for (unsigned int j = 0; j < vSeals.size(); j++) {
        if (vSeals[i].isOverlapped(vSeals[j])) vSeals[i].overlapping++;
      }
    }
    for (unsigned int i = 0; i < vSeals.size(); i++) {
      maxOverlapped = max(maxOverlapped, vSeals[i].overlapping);
    }
    cout << maxOverlapped << endl;
  }
  return 0;
}
