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

const long long MAXN=5e4;

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

pair<string, long long>div2(string& x)
{
    long long prenos=0;
    string ans;
    for (long long i=0; i<x.size(); i++)
    {
        long long sum=prenos*10+(x[i]-'0');

        ans.push_back(sum/2+'0');
        prenos=sum%2;
    }

    reverse(ans.begin(), ans.end());
    while (ans.size() && ans.back()=='0') ans.pop_back();
    reverse(ans.begin(), ans.end());

    if (ans.size()==0) return {"0", prenos};

    return {ans, prenos};
}

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

    while (curr!="0")
    {
        pair<string, long long>ret=div2(curr);

        ans.push_back(ret.second+'0');
        curr=ret.first;
    }

    return ans;
}

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

long long br=0;

void dfs(long long x)
{
    if (x<=n) used[x]=true;
    else
    {
        usedbits[x-n]=curr;
        br++;
    }

    for (auto next:graph[x])
    {
        if (used[next] || usedbits[next-n]==curr) 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++) cin>>a[i];

    for (long long i=1; i<=n; i++)
    {
        string bin=to_bin(a[i]);

        for (long long j=0; j<bin.size(); j++)
        {
            if (bin[j]=='1')
            {
                graph[i].push_back(n+j+1);
                graph[n+j+1].push_back(i);
            }
        }
    }

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

        answer=max(answer, br);
    }

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