#include <bits/stdc++.h>
inline bool is_overlap(std::pair<double, double> const& center1,
                       std::pair<double, double> const& center2) {
  return ((center1.first - center2.first) * (center1.first - center2.first) +
          (center1.second - center2.second) *
              (center1.second - center2.second)) <= 4;
}
int main() {
  std::uint16_t n;
  for (std::cin >> n; n != 0; std::cin >> n) {
    std::vector<std::pair<double, double>> centers(n);
    for (std::pair<double, double>& center : centers) {
      char comma;
      std::cin >> center.first >> comma >> center.second;
    }
    std::vector<std::bitset<100>> datas(n);
    for (std::size_t i = 0; i < centers.size(); ++i) {
      for (std::size_t j = 0; j < centers.size(); ++j) {
        if (is_overlap(centers[i], centers[j])) {
          datas[i].set(j, true);
        }
      }
    }
    std::size_t num_overlap = 0;
    for (auto const data : datas) {
      if (data.count() < num_overlap) {
        continue;
      }
      for (std::size_t i = 0, j = 0; i < data.count(); ++i, ++j) {
        while (data[j] == false) {
          ++j;
        }
        if (datas[j].count() < num_overlap) {
          continue;
        }
        num_overlap = std::max((data & datas[j]).count(), num_overlap);
      }
    }
    std::cout << num_overlap << std::endl;
  }
  return 0;
}
