#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  double x[102], y[102];
  char z;
  while (cin >> n) {
    if (n == 0) break;
    for (int i = 0; i < n; i++) cin >> x[i] >> z >> y[i];
    int h = 1;
    for (double i = 0.0; i <= 10; i += 0.02) {
      for (double j = 0.0; j <= 10; j += 0.02) {
        int w = 0;
        for (int k = 0; k < n; k++) {
          if (sqrt((double)(x[k] - i) * (x[k] - i) + (y[k] - j) * (y[k] - j)) <=
              1) {
            w++;
          }
        }
        if (w > h) h = w;
      }
    }
    cout << h << endl;
  }
  getchar();
  getchar();
  return 0;
}
