#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
 
using namespace std;
 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-7;

bool check(double x1, double y1, double x2, double y2){
	double dx = x1-x2, dy = y1-y2;
	return dx*dx+dy*dy<=1+EPS;
}


int main(){
	int n;
	char cc;
	while(cin>>n && n){
		vector<pair<double, double> > v;
		pair<double, double> p;
		vector<pair<double, double> > c;
		double x, y;
		rep(i, n){
			cin>>x>>cc>>y;
			v.pb(mp(x-1, y));
			v.pb(mp(x+1, y));
			v.pb(mp(x, y-1));
			v.pb(mp(x, y+1));
			c.pb(mp(x, y));
		}
		sort(all(v));
		int tmp = 0, ans = 0;
		for(int i = 0; i < v.size(); i++){
			tmp = 0;
			for(int j = 0; j < c.size(); j++){
				if(check(v[i].fi, v[i].se, c[j].fi, c[j].se)){
					tmp++;
				}
			}
			ans = max(ans, tmp);
		}
		cout<<ans<<endl;
	}
}