#include <bits/stdc++.h>
using namespace std;
const int MAX_SIZE = 10000;
double dot(complex<double> a, complex<double> b) {
  return (a.real() * b.real() + a.imag() * b.imag());
}
double cross(complex<double> a, complex<double> b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
int is_point_on_line(complex<double> a, complex<double> b, complex<double> c) {
  return (abs((cross(b - a, c - a)) - (0.0)) < (1e-10));
}
int is_orthogonal(complex<double> a1, complex<double> a2, complex<double> b1,
                  complex<double> b2) {
  return (abs((dot(a1 - a2, b1 - b2)) - (0.0)) < (1e-10));
}
int is_parallel(complex<double> a1, complex<double> a2, complex<double> b1,
                complex<double> b2) {
  return (abs((cross(a1 - a2, b1 - b2)) - (0.0)) < (1e-10));
}
double distance_l_p(complex<double> a, complex<double> b, complex<double> c) {
  return abs(cross(b - a, c - a)) / abs(b - a);
}
double distance_ls_p(complex<double> a, complex<double> b, complex<double> c) {
  if (dot(b - a, c - a) < (1e-10)) return abs(c - a);
  if (dot(a - b, c - b) < (1e-10)) return abs(c - b);
  return abs(cross(b - a, c - a)) / abs(b - a);
}
int is_intersected_ls(complex<double> a1, complex<double> a2,
                      complex<double> b1, complex<double> b2) {
  return (cross(a2 - a1, b1 - a1) * cross(a2 - a1, b2 - a1) < (1e-10)) &&
         (cross(b2 - b1, a1 - b1) * cross(b2 - b1, a2 - b1) < (1e-10));
}
complex<double> intersection_ls(complex<double> a1, complex<double> a2,
                                complex<double> b1, complex<double> b2) {
  complex<double> b = b2 - b1;
  double d1 = abs(cross(b, a1 - b1));
  double d2 = abs(cross(b, a2 - b1));
  double t = d1 / (d1 + d2);
  return a1 + (a2 - a1) * t;
}
int is_intersected_l(complex<double> a1, complex<double> a2, complex<double> b1,
                     complex<double> b2) {
  return !(abs((cross(a1 - a2, b1 - b2)) - (0.0)) < (1e-10));
}
complex<double> intersection_l(complex<double> a1, complex<double> a2,
                               complex<double> b1, complex<double> b2) {
  complex<double> a = a2 - a1;
  complex<double> b = b2 - b1;
  return a1 + a * cross(b, b1 - a1) / cross(b, a);
}
bool isCircleCrossLine(complex<double> a, complex<double> b, complex<double> c,
                       double r) {
  double d1 = abs(a - c);
  double d2 = abs(b - c);
  if (d1 < r && d2 < r) {
    return false;
  }
  double d = distance_ls_p(a, b, c);
  if ((abs((d) - (r)) < (1e-10)) || d < r) {
    return true;
  } else
    return false;
}
bool isInTriangle(complex<double> p1, complex<double> p2, complex<double> p3,
                  complex<double> s) {
  complex<double> a = p1 - s;
  complex<double> b = p2 - s;
  complex<double> c = p3 - s;
  return ((cross(a, b) > 0 && cross(b, c) > 0 && cross(c, a) > 0) ||
          (cross(a, b) < 0 && cross(b, c) < 0 && cross(c, a) < 0));
}
double calcAreaOfTriangle(complex<double> a, complex<double> b,
                          complex<double> c) {
  return abs((b.real() - a.real()) * (c.imag() - a.imag()) -
             (c.real() - a.real()) * (b.imag() - a.imag())) /
         2;
}
int main() {
  int n;
  while (cin >> n && n != 0) {
    vector<complex<double> > ps;
    double x, y;
    for (int i = 0; i < n; i++) {
      char ch;
      cin >> x >> ch >> y;
      ps.push_back(complex<double>(x, y));
    }
    int maxDot = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (i == 2 && j == 9) {
        }
        complex<double> &p1 = ps[i];
        complex<double> &p2 = ps[j];
        double dist = abs(p1 - p2);
        if (dist > 2 || (abs((dist) - (2)) < (1e-10))) continue;
        complex<double> e = (p1 - p2);
        e = complex<double>(-e.imag(), e.real());
        e /= abs(e);
        double b = sqrt(1 - (abs(p1 - p2) / 2) * (abs(p1 - p2) / 2));
        vector<complex<double> > vp;
        complex<double> tp = p1 + p2;
        tp /= 2;
        for (int k = 0; k < 2; k++) {
          vp.push_back(e * b + tp);
          e = -e;
        }
        for (int k = 0; k < 2; k++) {
          int cnt = 2;
          for (int l = 0; l < n; l++) {
            if (l == i || l == j) continue;
            if (((ps[l].real() - vp[k].real()) * (ps[l].real() - vp[k].real()) +
                     (ps[l].imag() - vp[k].imag()) *
                         (ps[l].imag() - vp[k].imag()) <
                 1) ||
                (abs(((ps[l].real() - vp[k].real()) *
                          (ps[l].real() - vp[k].real()) +
                      (ps[l].imag() - vp[k].imag()) *
                          (ps[l].imag() - vp[k].imag())) -
                     (1)) < (1e-10))) {
              cnt++;
            }
          }
          maxDot = max(maxDot, cnt);
        }
      }
    }
    cout << maxDot << endl;
  }
  return 0;
}
