#include <bits/stdc++.h>
struct point {
  double x;
  double y;
};
std::istream& operator>>(std::istream& s, point& p) {
  char c;
  return s >> p.x >> c >> p.y;
}
double getDistance(const point& a, const point& b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
int main(void) {
  int n;
  while (1) {
    std::cin >> n;
    if (n == 0) {
      break;
    }
    point p[100];
    for (int i = 0; i < n; i++) {
      std::cin >> p[i];
    }
    int counter = 1;
    for (int i = 0; i < n; i++) {
      int counterTmp = 1;
      for (int j = 0; j < n; j++) {
        if (i == j) {
          continue;
        }
        if (getDistance(p[i], p[j]) <= 2.0) {
          counterTmp++;
        }
      }
      if (counter < counterTmp) {
        counter = counterTmp;
      }
    }
    std::cout << counter << std::endl;
  }
  return 0;
}
