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

const long long MAXN=5e4;

long long n;
__int128 a[MAXN+10];



string to_bin(__int128 x)
{
    string ans;
    __int128 curr=x;

    while (curr!=0)
    {
        ans.push_back(curr%2+'0');
        curr/=2;
    }

    return ans;
}

vector<long long>graph[100'000];
long long answer=0;
bool used[100'005];
long long br=0;

void dfs(long long x)
{
    if (graph[x].size()!=0) br++;
    used[x]=true;
    for (auto next:graph[x])
    {
        if (used[next]) continue;
        dfs(next);
    }
}

int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for (long long i=1; i<=n; i++)
    {
        string s;
        cin>>s;



        for (long long j=0; j<s.size(); j++)
        {
            a[i]*=10;
            a[i]+=s[j]-'0';
        }

    }

    long long mx=0;
    for (long long i=1; i<=n; i++)
    {
        string bin=to_bin(a[i]);
        long long mn=1e9;
        long long sz=bin.size();
        mx=max(mx, sz);
        for (long long j=0; j<bin.size(); j++)
        {
            if (bin[j]=='1')
            {
                mn=min(mn, j+1);
                graph[j+1].push_back(mn);
                graph[mn].push_back(j+1);
            }
        }
    }

    for (long long i=1; i<=mx; i++)
    {
        if (used[i]) continue;
        br=0;

        dfs(i);

        answer=max(answer, br);
    }

    cout<<answer<<endl;
    return 0;
}



