# include <bits/stdc++.h>
using namespace std;
const int maxB = 1005;
bool g[maxB][maxB];
const long long step = (1LL << 32);

long long divide(string &s) {
	string t;
	unsigned long long rem = 0;
	for (char c : s) {
		rem = rem * 10 + (c - '0');
		unsigned long long digit = rem / step;
		rem %= step;
		if (!t.empty() || digit != 0) {
			t.push_back(('0' + digit));
		}
	}
	if (t.empty()) {
		t = "0";
	}
	s.swap(t);
	return static_cast<long long>(rem);
}
bool visited[maxB];
void parse(string &s) {
	vector<int> bits;
	int block = 0;
	while (s != "0") {
		long long rem = divide(s);
		for (int i = 0; i < 32; i++) {
			if ((rem >> i) & 1LL) {
				int pos = block * 32 + i;
				if (pos < maxB) {
					bits.push_back(pos);
				}
			}
		}
		block++;
	}
	if (bits.size() < 1) {
		return;
	}
	int first = bits.front();
	visited[first] = false;
	for (size_t i = 1; i < bits.size(); i++) {
		int b = bits[i];
		visited[b] = false;
		g[first][b] = true;
		g[b][first] = true;
	}
}
int cnt;
void dfs(int v) {
	visited[v] = true;
	cnt++;
	for (int i = 0; i < maxB; i++) {
		if (g[v][i] && !visited[i]) {
			dfs(i);
		}
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	int n;
	cin >> n;
	fill(visited, visited + maxB, true);
	string s;
	for (int i = 0; i < n; i++) {
		cin >> s;
		parse(s);
	}
	int ans = 0;
	for (int i = 0; i < maxB; i++) {
		if (!visited[i]) {
			cnt = 0;
			dfs(i);
			ans = max(ans, cnt);
		}
	}
	cout << ans << "\n";
}
