import std.stdio, std.algorithm, std.range, std.conv, std.string, std.math, std.container, std.typecons;
import core.stdc.stdio;
// foreach, foreach_reverse, writeln

void main() {
	int n;
	scanf("%d", &n);
	int[] a = new int[n];
	foreach (i; 0..n) scanf("%d", &a[i]);
	int[int] t;
	t[0] = 0;
	long ans = 0;
	foreach (i; 0..n) {
		int[int] prev;
		swap(prev, t);
		prev[0]++;
		foreach (x; prev.byKey()) {
			if ((x&a[i]) == 0) {
				ans += prev[x];
				int y = x|a[i];
				if (y in t) {
					t[y] += prev[x];
				} else {
					t[y] = prev[x];
				}
			}
		}
		if (!(0 in t)) {
			t[0] = 0;
		}
	}
	writeln(ans);
}