#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
int n;
double X[101];
double Y[101];
double getDistance(double x1, double y1, double x2, double y2) {
  double x = x2 - x1;
  double y = y2 - y1;
  return sqrt(x * x + y * y);
}
bool equal(double a, double b) { return fabs(a - b) < eps; }
int solve() {
  int answer = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i == j) continue;
      double D1 = getDistance(X[i], Y[i], X[j], Y[j]);
      double D2 = fabs(Y[j] - Y[i]);
      double L = sqrt(D1 * D1 - D2 * D2);
      double cx = L * L / (2.0 * L);
      if (equal(2.0, L)) {
        double cy = 0.0;
        int cnt = 2;
        for (int k = 0; k < n; ++k) {
          if (k == i || k == j) continue;
          double d = getDistance(cx + X[i], cy + Y[i], X[k], Y[k]);
          if (equal(d, 1.0) || d < 1.0) {
            ++cnt;
          }
        }
        answer = max(answer, cnt);
      } else if (2.0 > L) {
        double cy1 = sqrt(1 - cx * cx);
        double cy2 = -cy1;
        int cnt1 = 2;
        int cnt2 = 2;
        for (int k = 0; k < n; ++k) {
          if (k == i || k == j) continue;
          double d1 = getDistance(cx + X[i], cy1 + Y[i], X[k], Y[k]);
          if (equal(d1, 1.0) || d1 < 1.0) {
            ++cnt1;
          }
          double d2 = getDistance(cx + X[i], cy2 + Y[i], X[k], Y[k]);
          if (equal(d2, 1.0) || d2 < 1.0) {
            ++cnt2;
          }
        }
        answer = max(answer, max(cnt1, cnt2));
      }
    }
  }
  return answer;
}
int main() {
  while (cin >> n && n) {
    for (int i = 0; i < n; ++i) {
      string line;
      cin >> line;
      replace(line.begin(), line.end(), ',', ' ');
      istringstream is(line);
      is >> X[i] >> Y[i];
    }
    cout << solve() << endl;
  }
  return 0;
}
