#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+5;
ll n,A[N];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>A[i];
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		ll sum1=0;
		ll sum2=0;
		for(int j=i;j<=n;j++)
		{
			sum1|=A[i];
			sum2+=A[i];
			if(sum1<sum2)
			{
				break;
			}
			else
			{
				step++;
			}
		}
	}
	cout<<step<<endl;
	return 0;
}