import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int read() { return readln.chomp.to!int; }
int[] reads() { return readln.split.to!(int[]); }

void solve() {
    int n = read();
    int[] a = reads();

    int r, m;
    long ans;
    foreach (l; 0..n) {
        while (r < n && !(m & a[r])) {
            m ^= a[r++];
        }
        ans += r - l;
        m ^= a[l];
    }
    writeln(ans);
}


void main() {
    solve();
    readln;
}