#include <bits/stdc++.h>
using namespace std;
double d2(pair<double, double> p1, pair<double, double> p2) {
  double dx = p1.first - p2.first;
  double dy = p1.second - p2.second;
  return dx * dx + dy * dy;
}
pair<double, double> sub(pair<double, double> p1, pair<double, double> p2) {
  return pair<double, double>(p1.first - p2.first, p1.second - p2.second);
}
pair<double, double> add(pair<double, double> p1, pair<double, double> p2) {
  return pair<double, double>(p1.first + p2.first, p1.second + p2.second);
}
pair<double, double> div(pair<double, double> p, double val) {
  return pair<double, double>(p.first / val, p.second / val);
}
pair<double, double> middle(pair<double, double> p1, pair<double, double> p2) {
  return div(add(p1, p2), 2.0);
}
double norm(pair<double, double> p) {
  return sqrt(p.first * p.first + p.second * p.second);
}
pair<double, double> normalize(pair<double, double> p) {
  double n = norm(p);
  return div(p, n);
}
pair<double, double> rotate(pair<double, double> p, double th) {
  double x = cos(th) * p.first - sin(th) * p.second;
  double y = sin(th) * p.first + cos(th) * p.second;
  return pair<double, double>(x, y);
}
void cross(pair<double, double> p1, pair<double, double> p2,
           pair<double, double> &a1, pair<double, double> &a2) {
  pair<double, double> v = normalize(sub(p1, p2));
  double th = acos(sqrt(d2(p1, p2)) / 2.0);
  a1 = add(rotate(v, th), p2);
  a2 = add(rotate(v, -th), p2);
}
void print(pair<double, double> p) {
  cerr << p.first << ", " << p.second << endl;
}
int main() {
  while (true) {
    int n;
    scanf("%d\n", &n);
    if (n == 0) break;
    vector<pair<double, double> > vs(n);
    for (int i = 0; i < n; i++) {
      double x, y;
      scanf("%lf,%lf", &x, &y);
      vs[i] = make_pair(x, y);
    }
    vector<pair<double, double> > cands;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        double d = d2(vs[i], vs[j]);
        if (d == 4) {
          cands.push_back(middle(vs[i], vs[j]));
        } else if (d < 4) {
          pair<double, double> p1, p2;
          cross(vs[i], vs[j], p1, p2);
          cands.push_back(p1);
          cands.push_back(p2);
        }
      }
    }
    int maxCount = 1;
    for (pair<double, double> p : cands) {
      int c = 0;
      for (pair<double, double> v : vs) {
        if (d2(p, v) <= 1.0) {
          c++;
        }
      }
      maxCount = max(maxCount, c);
    }
    cout << maxCount << endl;
  }
}
