#include <bits/stdc++.h>
using namespace std;

typedef long double ld;

const ld EPS = 1e-9;
const ld INF = 1e10;
const ld PI = M_PI;

struct Point{
  ld x, y;
  Point(ld x, ld y):x(x), y(y){}
  Point(){}
};

Point operator+(const Point &a, const Point &b){
  return Point(a.x + b.x, a.y + b.y);
}
Point operator-(const Point &a, const Point &b){
  return Point(a.x - b.x, a.y - b.y);
}
Point operator*(const Point &a, const ld b){
  return Point(a.x * b, a.y * b);
}
Point operator*(const Point &a, const Point &b){
  return Point(a.x*b.x-a.y*b.y, a.x*b.y+a.y*b.x);
}
Point operator/(const Point &a, const ld b){
  return Point(a.x / b, a.y / b);
}

ld dot(const Point &a, const Point &b){
  return a.x*b.x + a.y*b.y;
}
ld norm(const Point &a){
  return dot(a, a);
}

bool operator<(const Point &a, const Point &b){
  return make_pair(a.x, a.y) < make_pair(b.x, b.y);
}
bool operator==(const Point &a, const Point &b){
  return a.x == b.x && a.y == b.y;
}
ld atan(const Point &a){
  return atan2(a.y, a.x);
}

ld abs(const Point &a){
  return sqrt(norm(a));
}

struct Circle: Point{
  ld r;
  Circle(Point p = Point(0, 0), ld r = 0):Point(p), r(r){}
};

bool is_intersect_CC(const Circle &c, const Circle &d){
  return abs(c-d) <= c.r+d.r + EPS && abs(c-d) >= abs(c.r-d.r) + EPS;
}

int main(){
  int n;
  while(cin >> n, n){
    ld x, y;
    char c;
    vector<Circle> C;
    for(int i = 0 ; i < n ; i++){
      cin >> x >> c >> y;
      C.push_back(Circle(Point(x, y), 1.0));
    }
    
    int overlap[110];
    memset(overlap, 0, sizeof(overlap));
    
    for(int i = 0 ; i < (int)C.size() ; i++){
      for(int j = i+1 ; j < (int)C.size() ; j++){
	if(is_intersect_CC(C[i], C[j])) overlap[i]++, overlap[j]++;
      }
    }
    int ans = 0;
    for(int i = 0 ; i < n ; i++) ans = max(ans, overlap[i]);
    cout << ans+1 << endl;
  }  
  return 0;
}