#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 30)
using namespace std;

typedef complex<double> Point;

int main(){
    int n;
    while(cin >> n, n){
        vector<Point> vp;
        rep(i,n){
            Point p;
            double a, b;
            char g;
            cin >> a >> g >> b;
            p.real(a); p.imag(b);
            vp.push_back(p);
        }
        int ans = 1;
        rep(i,vp.size()){
            int sum = 1;
            rep(j,vp.size()){
                if(i == j) continue; 
                if(abs(vp[i] - vp[j]) <= 2) sum++;
            }
            ans = max(ans, sum);
        }
        cout << ans << endl;
    }
}