#include <bits/stdc++.h>
using namespace std;
inline long double dist2(pair<long double, long double> a,
                         pair<long double, long double> b) {
  return ((a.first - b.first) * (a.first - b.first)) +
         ((a.second - b.second) * (a.second - b.second));
}
inline long double dist(pair<long double, long double> a,
                        pair<long double, long double> b) {
  return sqrt(dist2(a, b));
}
int main() {
  int n;
  while (cin >> n && n) {
    vector<pair<long double, long double> > c(n);
    char ch;
    for (int i = 0; i < n; i++) cin >> c[i].first >> ch >> c[i].second;
    vector<pair<long double, long double> > p;
    for (int i = 0; i < n - 1; i++) {
      for (int j = i + 1; j < n; j++) {
        if (dist2(c[i], c[j]) <= 4.0 + (1e-5)) {
          long double xc = (c[i].first + c[j].first) / 2;
          long double yc = (c[i].second + c[j].second) / 2;
          long double a = dist(c[i], c[j]) / 2;
          long double len = sqrt(1.0 - a * a);
          long double vlen = sqrt(((c[i].first - xc) * (c[i].first - xc)) +
                                  ((c[i].second - yc) * (c[i].second - yc)));
          long double v1x = len * (c[i].first - xc) / vlen;
          long double v1y = len * (c[i].second - yc) / vlen;
          pair<long double, long double> p1(xc - v1y, yc + v1x);
          pair<long double, long double> p2(xc + v1y, yc - v1x);
          p.push_back(p1);
          p.push_back(p2);
        }
      }
    }
    int N = p.size();
    int res = 0;
    for (int i = 0; i < N; i++) {
      int cnt = 0;
      for (int j = 0; j < n; j++) {
        if (dist(p[i], c[j]) <= 1.0 + (1e-5)) cnt++;
      }
      res = max(res, cnt);
    }
    cout << res << endl;
  }
  return 0;
}
