import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long calc(int[] a) {
    long ans = 0;
    int hi = 0;
    int sum = 0;
    for (int lo = 0; lo < a.length; lo++) {
        // hi を伸ばせるところまで伸ばす
        while (hi < a.length && sum + a[hi] == (sum ^ a[hi])) {
            sum += a[hi++];
        }
        ans += hi - lo + 1 - 1;
        // lo を右にずらすのでその分だけ引く
        sum -= a[lo];
        hi = max(hi, lo);
    }
    return ans;
}

void main() {
    readint;
    auto a = readints;
    writeln(calc(a));
}
