#include <bits/stdc++.h>
using namespace std;
class P {
 public:
  double x, y;
  P(double _x = 0, double _y = 0) : x(_x), y(_y){};
  P operator+(const P &p) const { return P(x + p.x, y + p.y); }
  P operator-(const P &p) const { return P(x - p.x, y - p.y); }
  P operator*(const double k) const { return P(x * k, y * k); }
  P operator/(const double k) const { return P(x / k, y / k); }
};
typedef P Vector;
double sqDist(P a, P b) {
  return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
pair<P, P> geoGetCircleOf2pAndR(P p1, P p2, double r) {
  P pc1, pc2, p3;
  double d, l, dx, dy;
  p3 = (p1 + p2) / 2.0;
  l = sqDist(p2, p3);
  if (r * r < l)
    return pair<P, P>(P(-999999999, -999999999), P(-999999999, -999999999));
  d = sqrt(r * r / l - 1.0);
  dx = d * (p2 - p3).y;
  dy = d * (p2 - p3).x;
  pc1.x = p3.x + dx;
  pc1.y = p3.y - dy;
  pc2.x = p3.x - dx;
  pc2.y = p3.y + dy;
  return pair<P, P>(pc1, pc2);
}
int main() {
  int n;
  while (cin >> n && n) {
    vector<P> points(n);
    char ch;
    for (long long i = 0; i < (long long)(n); i++)
      cin >> points[i].x >> ch >> points[i].y;
    int ans = 1;
    for (long long i = 0; i < (long long)(n); i++) {
      for (int j = i + 1; j < n; j++) {
        P res[2];
        tie(res[0], res[1]) = geoGetCircleOf2pAndR(points[i], points[j], 1);
        if (res[0].x == -999999999) continue;
        for (long long k = 0; k < (long long)(2); k++) {
          int tmp = 0;
          P ri = res[k];
          for (long long l = 0; l < (long long)(n); l++) {
            if (sqDist(ri, points[l]) <= 1) tmp++;
          }
          ans = max(tmp, ans);
        }
      }
    }
    cout << ans << endl;
  }
}
