#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

// セグメントツリー (点変更・区間クエリ)
template <typename monoid>
struct segment_tree {
    using M = monoid;
    using T = typename M::value_type;

    size_t sz;
    vector<T> x;

    segment_tree(size_t n = 0) {
        sz = 1;
        while (sz < n) sz *= 2;
        x.assign(sz * 2, M::id());
        initialize();
    }

    template <typename iterator>
    segment_tree(iterator first, iterator last) {
        sz = 1;
        size_t n = distance(first, last);
        while (sz < n) sz *= 2;
        x.assign(sz * 2, M::id());
        copy(first, last, x.begin() + sz);
        initialize();
    }

    void fill(const T& val) {
        std::fill(x.begin() + sz, x.end(), val);
        initialize();
    }

    void initialize() {
        for (int i = (int)sz - 1; i >= 1; --i) {
            x[i] = M::op(x[i * 2 + 0], x[i * 2 + 1]);
        }
    }

    T accumulate(size_t l, size_t r) const {  // [l, r)
        T al = M::id(), ar = M::id();
        for (l += sz, r += sz; l < r; l /= 2, r /= 2) {
            if (l & 1) al = M::op(al, x[l++]);
            if (r & 1) ar = M::op(x[--r], ar);
        }
        return M::op(al, ar);
    }

    void update(size_t i, const T &val) {
        x[i += sz] = val;
        while (i > 1) {
            x[i / 2] = M::op(x[i], x[i ^ 1]);
            i /= 2;
        }
    }

    T operator[](size_t i) const { return x[sz + i]; }
};

template <typename T>
struct xor_monoid {
    using value_type = T;
    static constexpr value_type id() { return 0; }
    static value_type op(const value_type &a, const value_type &b) { return a ^ b; }
};

template <typename T>
struct sum_monoid {
    using value_type = T;
    static constexpr value_type id() { return 0; }
    static value_type op(const value_type &a, const value_type &b) { return a + b; }
};

template <typename value_type>
using rxq = segment_tree<xor_monoid<value_type>>;

template <typename value_type>
using rsq = segment_tree<sum_monoid<value_type>>;

int main(void) {
    lint n; cin >> n;
    vector<lint> a(n); repeat (i, n) cin >> a[i];
    
    rxq<lint> xortree(a.begin(), a.end());
    rsq<lint> sumtree(a.begin(), a.end());
    
    /*
    int tmp = 0;
    repeat (i, n) {
        repeat_from (j, i+1, n+1) {
            dump(i); dump(j);
            if (xortree.accumulate(i, j) == sumtree.accumulate(i, j)) {
                ++tmp; cout << "true : tmp=" << tmp << endl;
            }
            else {
                cout << "false" << endl;
            }
        }
    }
    */
    
    auto is_ok = [&](lint left, lint right) -> bool {
        return (xortree.accumulate(left, right) == sumtree.accumulate(left, right));
    };
    
    auto nibutan = [&](lint start) -> lint {
        lint left = start;
        lint right = n + 1;
        while (right - left > 1) {
            lint mid = (left + right) / 2;
            if (is_ok(start, mid)) left = mid;
            else right = mid;
        }
        return left;
    };
    
    lint ans = 0;
    repeat (i, n) {
        lint end = nibutan(i);
        ans += (end - i);
        //dump(i); dump(end); dump(ans); el;
    }
    cout << ans << endl;
}

Measured memory_bytes: 9984