#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-7;
int main(void) {
  int n;
  while (cin >> n, n) {
    vector<pair<double, double> > v;
    double a, b;
    for (int i = 0; i < n; ++i) {
      scanf("%lf,%lf", &a, &b);
      v.push_back(make_pair(a, b));
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      int tmp = 0;
      for (int j = 0; j < n; ++j)
        if (fabs(((v[i].first - v[j].first) * (v[i].first - v[j].first)) +
                 ((v[i].second - v[j].second) * (v[i].second - v[j].second))) -
                ((2.0) * (2.0)) <
            EPS)
          ++tmp;
      ans = max(ans, tmp);
    }
    cout << ans << endl;
  }
}
