#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

struct point {
  double x, y;
};

int main() {
  int n;
  while (cin >> n, n) {
    vector<point> ps(n);
    for (int i = 0; i < n; ++i)
      scanf("%lf,%lf", &ps[i].x, &ps[i].y);

    int cntmax = 0;
    for (int i = 0; i < 1000; ++i) {
      for (int j = 0; j < 1000; ++j) {
        double x = i * 0.01;
        double y = j * 0.01;
        int cnt = 0;
        auto f = [&](auto &v) { cnt += pow(v.x - x, 2) + pow(v.y - y, 2) <= 1; };
        for_each(ps.begin(), ps.end(), f);
        cntmax = (cntmax < cnt) ? cnt : cntmax;
      }
    }
    cout << cntmax << endl;
  }
}
