#include <bits/stdc++.h>
using namespace std;
int n, ans;
pair<double, double> circle[105];
double sq(double x) { return x * x; }
double culc_dist(int s, int t) {
  pair<double, double> a = circle[s], b = circle[t];
  return sqrt(sq(a.first - b.first) + sq(a.second - b.second));
}
double dist(pair<double, double> a, pair<double, double> b) {
  return sqrt(sq(a.first - b.first) + sq(a.second - b.second));
}
bool is_intersect(int s, int t) { return culc_dist(s, t) <= 2; }
pair<double, double> center_pos(int s, int t) {
  pair<double, double> a = circle[s], b = circle[t];
  return pair<double, double>((a.first + b.first) / 2,
                              (a.second + b.second) / 2);
}
pair<double, double> normal_vector(int s, int t) {
  pair<double, double> a = circle[s], b = circle[t];
  return pair<double, double>(a.second - b.second, b.first - a.first);
}
pair<double, double> expand(int s, int t) {
  pair<double, double> n = normal_vector(s, t);
  double sin_x = sqrt(1 - (sq(culc_dist(s, t)) / 4));
  double len = sqrt(sq(n.first) + sq(n.second));
  return pair<double, double>(n.first * sin_x / len, n.second * sin_x / len);
}
int culc_covered(pair<double, double> p) {
  if (p.first < 0 || p.first > 10 || p.second < 0 || p.second > 10) return 0;
  int ret = 0;
  for (int i = 0; i < n; i++)
    if (dist(p, circle[i]) <= 1.0) ret++;
  return ret;
}
int main() {
  while (1) {
    cin >> n;
    if (n == 0) return 0;
    ans = 1;
    for (int i = 0; i < n; i++)
      scanf("%lf,%lf", &circle[i].first, &circle[i].second);
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (!is_intersect(i, j)) continue;
        pair<double, double> center = center_pos(i, j);
        pair<double, double> orientation = expand(i, j);
        ans = max(ans, culc_covered(pair<double, double>(
                           center.first - orientation.first,
                           center.second - orientation.second)));
        if (!(orientation.first == 0 && orientation.second == 0))
          ans = max(ans, culc_covered(pair<double, double>(
                             center.first + orientation.first,
                             center.second + orientation.second)));
      }
    }
    cout << ans << endl;
  }
  return 0;
}
