#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  for (; scanf("%d", &n), n;) {
    vector<pair<double, double> > circle;
    for (int i = 0; i < n; i++) {
      double tmp1, tmp2;
      char buf;
      cin >> tmp1 >> buf >> tmp2;
      circle.push_back(make_pair(tmp1, tmp2));
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
      int count = 0;
      for (int j = 0; j < n; j++) {
        double xc1 = circle[i].first;
        double xc2 = circle[j].first;
        double yc1 = circle[i].second;
        double yc2 = circle[j].second;
        if ((xc1 - xc2) * (xc1 - xc2) + (yc1 - yc2) * (yc1 - yc2) < 4.0)
          count++;
      }
      ans = max(count, ans);
    }
    cout << ans << endl;
  }
}
