### BUGGY CODE ###

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    def bit(n):
        b = [0] * 21

        for i in range(20, -1, -1):
            f = 2**i
            if n >= f:
                n -= f
                b[i] = 1

        return b

    B = []
    for a in A:
        B.append(bit(a))

    # for b in B:
    #     print(b)
    # print('--------')

    C = [[0] * 21]
    for i in range(0, N):
        C.append([c + b for c, b in zip(B[i], C[i])])

    BM = [[] for _ in range(21)]
    for j, bs in enumerate(B):
        for i, b in enumerate(bs):
            if b == 1:
                BM[i].append(j)

    ans = N
    for i in range(0, N):
        min_r = sys.maxsize
        for bm in BM:
            c = 0
            r = sys.maxsize
            for b in bm:
                if b >= i:
                    c += 1
                if c > 1:
                    r = b - 1
                    break
            else:
                r = N - 1
            min_r = min(min_r, r)
        ans += min_r - i if min_r > i else 0
    return ans


def main():
    N = read_int()
    A = read_int_n()
    # N = 2 * 100000
    # A = [0] * N
    print(slv(N, A))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
import time
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    ans = 0
    S = 0
    X = 0
    r = 0
    for l in range(N):
        while r != N and S + A[r] == X ^ A[r]:
            S += A[r]
            X ^= A[r]
            r += 1
        ans += r - l
        S -= A[l]
        X ^= A[l]

    return ans


def main():
    N = read_int()
    A = read_int_n()

    print(slv(N, A))


if __name__ == '__main__':
    main()