#include <bits/stdc++.h>
struct POINT {
  double x;
  double y;
  POINT& operator+=(const POINT& p) {
    x += p.x;
    y += p.y;
    return *this;
  }
  POINT& operator-=(const POINT& p) {
    x -= p.x;
    y -= p.y;
    return *this;
  }
  POINT& operator*=(double factor) {
    x *= factor;
    y *= factor;
    return *this;
  }
  POINT& operator/=(double factor) {
    x /= factor;
    y /= factor;
    return *this;
  }
};
POINT operator+(const POINT& a, const POINT& b) {
  POINT p(a);
  p += b;
  return p;
}
POINT operator-(const POINT& a, const POINT& b) {
  POINT p(a);
  p -= b;
  return p;
}
POINT operator*(const POINT& a, double factor) {
  POINT p(a);
  p *= factor;
  return p;
}
POINT operator/(const POINT& a, double factor) {
  POINT p(a);
  p /= factor;
  return p;
}
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));
}
double getSizeofVector(const POINT& vec) {
  return sqrt(pow(vec.x, 2) + pow(vec.y, 2));
}
void getCrossPoint(const POINT& a, const POINT& b, POINT* p1, POINT* p2) {
  POINT mid = (a + b) / 2;
  if (fabs(getDistance(a, b) - 1.0) < 1e-10) {
    *p1 = mid;
    *p2 = mid;
    return;
  } else {
    POINT ab = b - a;
    double theta = atan(ab.y / ab.x);
    double h = sqrt(pow(1.0, 2) - pow(getSizeofVector(ab) / 2, 2));
    p1->x = mid.x + h * cos(theta + 3.141592654 / 2);
    p1->y = mid.y + h * sin(theta + 3.141592654 / 2);
    p2->x = mid.x + h * cos(theta - 3.141592654 / 2);
    p2->y = mid.y + h * sin(theta - 3.141592654 / 2);
    return;
  }
}
int getMax(int a, int b) { return a > b ? a : b; }
int main(void) {
  while (1) {
    int n;
    std::cin >> n;
    if (n == 0) {
      break;
    }
    std::vector<POINT> o;
    for (int i = 0; i < n; i++) {
      POINT p;
      std::cin >> p;
      o.push_back(p);
    }
    int overlap = 1;
    for (int i = 0; i < n - 1; i++) {
      for (int j = i + 1; j < n; j++) {
        int cnt1, cnt2;
        if (getDistance(o[i], o[j]) <= 1.0 + 1e-10) {
          POINT p1, p2;
          getCrossPoint(o[i], o[j], &p1, &p2);
          cnt1 = 2;
          cnt2 = 2;
          for (int k = 0; k < n; k++) {
            if (k == i || k == j) {
              continue;
            }
            if (getDistance(o[k], p1) <= 1.0 + 1e-10) {
              cnt1++;
            }
            if (getDistance(o[k], p2) <= 1.0 + 1e-10) {
              cnt2++;
            }
          }
        } else {
          cnt1 = 0;
          cnt2 = 0;
        }
        if (overlap < getMax(cnt1, cnt2)) {
          overlap = getMax(cnt1, cnt2);
        }
      }
    }
    std::cout << overlap << std::endl;
  }
  return 0;
}
