#include <bits/stdc++.h>
using namespace std;
const int rad = 1;
struct circle {
  double x, y;
  int cost;
};
double dist(struct circle a, struct circle b) {
  double diffx = b.x - a.x, diffy = b.y - a.y;
  return (sqrt(diffx * diffx + diffy * diffy));
}
bool judge(struct circle a, struct circle b) { return (2 * rad >= dist(a, b)); }
int main(void) {
  int n;
  while (cin >> n, n) {
    struct circle data[n];
    int _max = INT_MIN;
    for (int r = 0; r < n; r++) {
      scanf("%lf,%lf", &data[r].x, &data[r].y);
      data[r].cost = 1;
      for (int c = 0; c < r; c++) {
        if (judge(data[r], data[c])) {
          _max = max(_max, ++data[r].cost);
          _max = max(_max, ++data[c].cost);
        }
      }
    }
    cout << _max << endl;
  }
  return (0);
}
