#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <complex>

#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define mk make_pair
#define EPS 1e-6

using namespace std;

typedef complex<double> P;

int main()
{
	int n,ans = 0;
	vector<P> res;

	while(cin >> n && n)
	{
		double x,y;
		char c;
		rep(i,n)
		{
			cin >> x >> c >> y;
			res.pb(P(x,y));
		}

		int count;
		rep(i,n)
		{
			count = 0;
			rep(j,n)
			{
				if(i != j)
				{
					P c = res[i] - res[j];

					if(abs(c) <= 2.0 + EPS)
					{
						count++;
					}
				}
			}
			ans = max(ans,count);
		}
		cout << ans+1 << endl;
	}
	return 0;
}