#include <bits/stdc++.h>
std::pair<double, double> operator+(const std::pair<double, double>& lhs,
                                    const std::pair<double, double>& rhs) {
  return std::make_pair(lhs.first + rhs.first, lhs.second + rhs.second);
}
std::pair<double, double> operator-(const std::pair<double, double>& lhs,
                                    const std::pair<double, double>& rhs) {
  return std::make_pair(lhs.first - rhs.first, lhs.second - rhs.second);
}
std::pair<double, double> operator*(const double& lhs,
                                    const std::pair<double, double>& rhs) {
  return std::make_pair(lhs * rhs.first, lhs * rhs.second);
}
double dist(const std::pair<double, double>& lhs,
            const std::pair<double, double>& rhs) {
  return std::sqrt(std::pow(lhs.first - rhs.first, 2) +
                   std::pow(lhs.second - rhs.second, 2));
}
bool inCircle(const std::pair<double, double>& pt) {
  return (std::pow(pt.first, 2) + std::pow(pt.second, 2) <=
          std::pow(1, 2) + 1e-10);
}
bool inCircle(const std::pair<double, double>& circ,
              const std::pair<double, double>& pt) {
  return inCircle(pt - circ);
}
std::pair<std::pair<double, double>, std::pair<double, double>> getCross(
    const std::pair<double, double>& lhs,
    const std::pair<double, double>& rhs) {
  double d = dist(lhs, rhs);
  double alpha = std::acos(d / (2 * 1));
  double theta = std::atan((lhs.second - rhs.second) / (lhs.first - rhs.first));
  return (std::make_pair(rhs + 1 * std::make_pair(std::cos(theta + alpha),
                                                  std::sin(theta + alpha)),
                         rhs + 1 * std::make_pair(std::cos(theta - alpha),
                                                  std::sin(theta - alpha))));
}
int main(void) {
  using namespace std;
  unsigned int N;
  cin >> N;
  for (; N != 0; cin >> N) {
    vector<pair<double, double>> v;
    v.reserve(N);
    for (int i = 1; i <= N; i++) {
      char sep;
      double x, y;
      cin >> x >> sep >> y;
      v.push_back(make_pair(x, y));
    }
    if (N == 1) {
      cout << 1 << endl;
      continue;
    }
    vector<bool> permTable(N);
    fill(permTable.begin() + 2, permTable.end(), true);
    unsigned int count = 1;
    do {
      vector<unsigned int> tmp;
      tmp.reserve(2);
      for (unsigned int i = 0; i < N; ++i) {
        if (!permTable[i]) {
          tmp.push_back(i);
        }
      }
      if (dist(v[tmp[0]], v[tmp[1]]) <= 2 * 1 + 1e-10) {
        auto cross = getCross(v[tmp[0]], v[tmp[1]]);
        unsigned int first = 2;
        unsigned int second = 2;
        for (auto itr = v.begin(); itr != v.end(); itr++) {
          if (*itr == v[tmp[0]] || *itr == v[tmp[1]]) {
            continue;
          } else if (inCircle(*itr, cross.first)) {
            first++;
          } else if (inCircle(*itr, cross.second)) {
            second++;
          }
        }
        count = std::max(count, std::max(first, second));
      }
    } while (std::next_permutation(permTable.begin(), permTable.end()));
    cout << count << endl;
  }
}
