#include <functional>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <time.h> 

template <typename T>
class abstract_inchworm
{
protected:
    virtual void move_left_pointer() = 0;
    virtual void move_right_pointer() = 0;
    virtual bool is_cond() = 0; //条件成立を返す
    virtual bool is_right_end() = 0;
    virtual std::pair<T, T> no_next() = 0;
    virtual std::pair<T, T> get_LR() = 0;

public:
    virtual std::pair<T, T> next() = 0; //条件を満たすデータを返し、ポインタを次に進める

    virtual ~abstract_inchworm();
};

template <typename T>
abstract_inchworm<T>::~abstract_inchworm()
{
}



//ある区間が条件を満たすならば、
//それが包含する部分区間も条件を満たす問題を解くクラス
template <typename T>
class abstract_inchworm_subset :
    public abstract_inchworm<T>
{
protected:
    virtual void move_left_pointer() = 0;
    virtual void move_right_pointer() = 0;
    virtual bool is_cond() = 0; //条件成立を返す
    virtual bool is_right_end() = 0;
    virtual std::pair<T, T> no_next() = 0;
    virtual std::pair<T, T> get_LR() = 0;
    virtual bool is_left_eq_right() = 0;
public:
    virtual std::pair<T, T> next(); //条件を満たすデータを返し、ポインタを次に進める
};

template <typename T>
std::pair<T, T> abstract_inchworm_subset<T>::next() {
    std::pair<T, T> ret;// = get_LR();
    while (is_right_end() == false && is_cond() == true) {

        move_right_pointer();
    }
    ret = get_LR();
    if (is_left_eq_right() == true)
        return no_next();
    
    move_left_pointer();
    return ret;
}



class xor_sum :
    public abstract_inchworm_subset<int>
{
private:
    int Left, Right;
    
    int N;
    long long LR_XOR;
    long long LRsum;
    std::vector<long long> sequence;
protected:
    virtual void move_left_pointer();
    virtual void move_right_pointer();
    virtual bool is_cond(); //条件成立を返す
    virtual bool is_right_end();
    virtual std::pair<int, int> no_next();
    virtual std::pair<int, int> get_LR();
    virtual bool is_left_eq_right();
public:

    xor_sum(std::vector<long long>& sequence, int N, int start);
};


xor_sum::xor_sum(std::vector<long long>& sequence, int N, int start) :
    sequence(sequence),
    N(N),
    Left(start),
    Right(start),
    LR_XOR(0),
    LRsum(0)
{
}


void xor_sum::move_left_pointer() {
    LRsum -= sequence[Left];
    LR_XOR ^= sequence[Left];
    Left++;

}

void xor_sum::move_right_pointer() {
    if (Right < N) {
        LRsum += sequence[Right];
        LR_XOR ^= sequence[Right];
        Right++;
    }
}

bool xor_sum::is_cond() {
    if (Left >= N) 
        return false;
    if ((LRsum + sequence[Right]) == (LR_XOR ^ sequence[Right]))
        return true;
    return false;
}

bool xor_sum::is_right_end() {
    if (Right >= N)
        return true;
    return false;
}

std::pair<int, int> xor_sum::no_next() {
    return std::make_pair(-1, -1);
}

std::pair<int, int> xor_sum::get_LR() {
    return std::make_pair(Left, Right);
}

bool xor_sum::is_left_eq_right() {
    return (Left == Right);

}



//#define SEQUENCE
//#define CHOKUSETSU
#define XORSUM
int main()
{

    int N;
    std::vector<long long> A;
    scanf("%d", &N);

    for (int i = 0; i < N; i++) {
        long long a;
        scanf("%lld", &a);
        A.push_back(a);
    }
    xor_sum xs(A, N, 0);
    long long count = 0;
    while (1) {
        std::pair<int, int> LR = xs.next();
        if (LR.first == -1) break;
        count += LR.second - LR.first ;
    }
    printf("%lld\n", count);

}


Measured memory_bytes: 3440