#include <bits/stdc++.h>
using namespace std;
struct S {
  double x, y, r;
};
bool cr_cr(double cx1, double cy1, double cr1, double cx2, double cy2,
           double cr2) {
  return pow(cx1 - cx2, 2.0) + pow(cy1 - cy2, 2.0) <=
         pow(cr1 + cr2, 2.0) + 1e-7;
}
int main() {
  int n;
  int cnt, ans;
  S seal[100];
  char gav;
  while (1) {
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      cin >> seal[i].x >> gav >> seal[i].y;
      seal[i].r = 1.0;
    }
    ans = 0;
    for (int i = 0; i < n; i++) {
      cnt = 1;
      for (int j = 0; j < n; j++) {
        if (i != j && cr_cr(seal[i].x, seal[i].y, seal[i].r, seal[j].x,
                            seal[j].y, seal[j].r)) {
          cnt++;
        }
      }
      ans = max(ans, cnt);
    }
    cout << ans << endl;
  }
}
