#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 = 1;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        int count = 0;
        double xc1 = circle[i].first;
        double xc2 = circle[j].first;
        double yc1 = circle[i].second;
        double yc2 = circle[j].second;
        if (i != j &&
            (xc1 - xc2) * (xc1 - xc2) + (yc1 - yc2) * (yc1 - yc2) < 4.0) {
          int count = 2;
          for (int k = 0; k < n; k++) {
            double xc3 = circle[k].first;
            double yc3 = circle[k].second;
            if (i != k && j != k &&
                (xc1 - xc3) * (xc1 - xc3) + (yc1 - yc3) * (yc1 - yc3) < 4.0 &&
                (xc2 - xc3) * (xc2 - xc3) + (yc2 - yc3) * (yc2 - yc3) < 4.0) {
              count++;
            }
          }
          ans = max(count, ans);
        }
      }
    }
    cout << ans << endl;
  }
}
