#include <bits/stdc++.h>
class is_overlap {
 public:
  is_overlap(std::pair<double, double> const& center1) : center1_(center1) {}
  bool operator()(std::pair<double, double> const& center2) const {
    return ((center1_.first - center2.first) *
                (center1_.first - center2.first) +
            (center1_.second - center2.second) *
                (center1_.second - center2.second)) <= 4;
  }

 private:
  std::pair<double, double> const& center1_;
};
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::uint16_t max_num_overlap = 0;
    for (std::pair<double, double> const& center : centers) {
      std::uint16_t const num_overlap =
          std::count_if(centers.begin(), centers.end(), is_overlap(center));
      max_num_overlap = std::max(num_overlap, max_num_overlap);
    }
    std::cout << max_num_overlap << std::endl;
  }
  return 0;
}
