#include <bits/stdc++.h>
using namespace std;
int n;
struct Circle {
  double x, y;
};
vector<Circle> seals;
bool overlap(Circle &c1, Circle &c2) {
  return (c1.x - c2.x) * (c1.x - c2.x) + (c1.y - c2.y) * (c1.y - c2.y) <
         4.000000001;
}
int count(vector<Circle> &v, int k) {
  int ret = v.size();
  for (int i = k; i < n; ++i) {
    bool ok = true;
    for (int j = 0; j < (int)v.size(); ++j) {
      if (!overlap(v[j], seals[i])) {
        ok = false;
        break;
      }
    }
    if (ok) {
      v.push_back(seals[i]);
      ret = max(ret, count(v, i + 1));
      v.pop_back();
    }
  }
  return ret;
}
int main() {
  while (cin >> n, n) {
    seals.clear();
    double x, y;
    char c;
    for (int i = 0; i < n; ++i) {
      cin >> x >> c >> y;
      seals.push_back((Circle){x, y});
    }
    int ret = 0;
    for (int i = 0; i < n; ++i) {
      vector<Circle> v(1, seals[i]);
      ret = max(ret, count(v, i + 1));
    }
    cout << ret << endl;
  }
  return 0;
}
