#include <bits/stdc++.h>
double dist(std::pair<double, double> lhs, std::pair<double, double> rhs) {
  return std::sqrt(std::pow(lhs.first - rhs.first, 2) +
                   std::pow(lhs.second - rhs.second, 2));
}
int main(void) {
  using namespace std;
  unsigned int N;
  cin >> N;
  for (; N != 0; cin >> N) {
    vector<pair<double, double>> v;
    vector<unsigned int> count(N, 1);
    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);
    vector<pair<set<unsigned int>, bool>> relation;
    do {
      vector<unsigned int> tmp;
      tmp.reserve(2);
      for (unsigned int i = 0; i < N; ++i) {
        if (!permTable[i]) {
          tmp.push_back(i);
        }
      }
      bool flag;
      if (dist(v[tmp[0]], v[tmp[1]]) < 2.0) {
        flag = true;
      } else {
        flag = false;
      }
      relation.push_back(
          make_pair(set<unsigned int>(tmp.begin(), tmp.end()), flag));
    } while (std::next_permutation(permTable.begin(), permTable.end()));
    for (int i = 0; i < N; i++) {
      for (auto itr = relation.begin(); itr != relation.end(); itr++) {
        if (itr->first.find(i) != itr->first.end() && itr->second) {
          count[i]++;
        }
      }
    }
    cout << *max_element(count.begin(), count.end()) << endl;
  }
}
