import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

class AddSegTree {
	long[] dat;
	int h;
	int n;

	AddSegTree(int num) {
		h = 0;
		while ((1 << h) < num)
			h++;
		n = 1 << h;
		int size = 2 * n - 1;
		dat = new long[size];
		for (int i = 0; i < size; i++) {
			dat[i] = ID;
		}
	}

	void update(int i, long x) {
		i += n - 1;
		dat[i] = x;
		while (i > 0) {
			i = i - 1 >> 1;
			dat[i] = combine(dat[i * 2 + 1], dat[i * 2 + 2]);
		}
	}

	void update(long[] xs, int offset) {
		int i = n - 1 + offset;
		int num = xs.length;
		for (int j = 0; j < num; j++) {
			dat[i + j] = xs[j];
		}
		for (int j = n - 2; j >= 0; j--) {
			dat[j] = combine(dat[j * 2 + 1], dat[j * 2 + 2]);
		}
	}

	long query(int from, int until) {
		return _query(from, until, 0, 0, n);
	}

	private long _query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l)
			return ID;
		if (a <= l && r <= b)
			return dat[k];
		long vl = _query(a, b, k * 2 + 1, l, l + r >> 1);
		long vr = _query(a, b, k * 2 + 2, l + r >> 1, r);
		return combine(vl, vr);
	}

	final long ID = 0;

	final long combine(long x, long y) {
		return x + y;
	}
}

class XorSegTree {
	long[] dat;
	int h;
	int n;

	XorSegTree(int num) {
		h = 0;
		while ((1 << h) < num)
			h++;
		n = 1 << h;
		int size = 2 * n - 1;
		dat = new long[size];
		for (int i = 0; i < size; i++) {
			dat[i] = ID;
		}
	}

	void update(int i, long x) {
		i += n - 1;
		dat[i] = x;
		while (i > 0) {
			i = i - 1 >> 1;
			dat[i] = combine(dat[i * 2 + 1], dat[i * 2 + 2]);
		}
	}

	void update(long[] xs, int offset) {
		int i = n - 1 + offset;
		int num = xs.length;
		for (int j = 0; j < num; j++) {
			dat[i + j] = xs[j];
		}
		for (int j = n - 2; j >= 0; j--) {
			dat[j] = combine(dat[j * 2 + 1], dat[j * 2 + 2]);
		}
	}

	long query(int from, int until) {
		return _query(from, until, 0, 0, n);
	}

	private long _query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l)
			return ID;
		if (a <= l && r <= b)
			return dat[k];
		long vl = _query(a, b, k * 2 + 1, l, l + r >> 1);
		long vr = _query(a, b, k * 2 + 2, l + r >> 1, r);
		return combine(vl, vr);
	}

	final long ID = 0;

	final long combine(long x, long y) {
		return x ^ y;
	}
}

public class Main {
	private static void solve() {
		int n = nei();
		long[] ls = nls(n);
		AddSegTree as = new AddSegTree(n);
		XorSegTree xs = new XorSegTree(n);
		as.update(ls, 0);
		xs.update(ls, 0);
		long ans = 0;
		for (int i = 0; i < n; i++) {
			int min = i;
			int max = n;
			while (max - min > 1) {
				int mid = min + max >> 1;
				if (as.query(i, mid + 1) == xs.query(i, mid + 1)) {
					// ok
					min = mid;
				} else {
					// ng
					max = mid;
				}
			}
			int num = min - i + 1;
			ans += num;
		}
		out(ans);
	}

	static int[] lis(int[] s) {
		int n = s.length;
		int[] dp = new int[n];
		int[] ids = new int[n];
		int[] pids = new int[n];
		dp[0] = s[0];
		int len = 1;
		int lidx = 0;
		for (int i = 1; i < n; i++) {
			int idx = bs(s[i], dp, 0, len);
			dp[idx] = s[i];
			ids[idx] = i;
			if (idx == len) {
				lidx = i;
				len++;
			}
			if (idx > 0)
				pids[i] = ids[idx - 1];
		}
		int[] lis = new int[len];
		lis[len - 1] = s[lidx];
		for (int i = len - 1; i >= 0; i--) {
			lis[i] = s[lidx];
			lidx = pids[lidx];
		}
		return lis;
	}

	static int bs(int a, int[] as, int from, int num) {
		int min = from;
		int max = from + num - 1;
		while (min < max) {
			int mid = min + max >> 1;
			if (as[mid] < a)
				min = mid + 1;
			else if (as[mid] > a)
				max = mid;
			else
				return mid;
		}
		return as[min] < a ? min + 1 : min;
	}

	static int gcd(int x, int y) {
		x = (x ^ x >> 31) - (x >> 31);
		y = (y ^ y >> 31) - (y >> 31);
		if (x < y) {
			x ^= y;
			y ^= x;
			x ^= y;
		}
		int z = x % y;
		if (z == 0)
			return y;
		return gcd(y, z);
	}

	static long gcd(long x, long y) {
		x = (x ^ x >> 63) - (x >> 63);
		y = (y ^ y >> 63) - (y >> 63);
		if (x < y) {
			x ^= y;
			y ^= x;
			x ^= y;
		}
		long z = x % y;
		if (z == 0)
			return y;
		return gcd(y, z);
	}

	static int lcm(int x, int y) {
		x = (x ^ x >> 31) - (x >> 31);
		y = (y ^ y >> 31) - (y >> 31);
		return x / gcd(x, y) * y;
	}

	static long lcm(long x, long y) {
		x = (x ^ x >> 63) - (x >> 63);
		y = (y ^ y >> 63) - (y >> 63);
		return x / gcd(x, y) * y;
	}

	static int abs(int x) {
		return x < 0 ? -x : x;
	}

	static long abs(long x) {
		return x < 0 ? -x : x;
	}

	static int min(int a, int b) {
		return a < b ? a : b;
	}

	static long min(long a, long b) {
		return a < b ? a : b;
	}

	static int max(int a, int b) {
		return a > b ? a : b;
	}

	static long max(long a, long b) {
		return a > b ? a : b;
	}

	static int clamp(int a, int min, int max) {
		return a < min ? min : a > max ? max : a;
	}

	static long clamp(long a, long min, long max) {
		return a < min ? min : a > max ? max : a;
	}

	static void out(String val) {
		IO.out(val);
	}

	static void out(Object val) {
		IO.out(String.valueOf(val));
	}

	static void out(int val) {
		IO.out(String.valueOf(val));
	}

	static void out(long val) {
		IO.out(String.valueOf(val));
	}

	static void out(char val) {
		IO.out(String.valueOf(val));
	}

	static void out(float val) {
		IO.out(String.valueOf(val));
	}

	static void out(double val) {
		IO.out(String.valueOf(val));
	}

	static void out(boolean val) {
		IO.out(String.valueOf(val));
	}

	static void kil(String val) {
		IO.out(val);
		IO.flush();
		System.exit(0);
	}

	static void kil(Object val) {
		IO.out(String.valueOf(val));
		IO.flush();
		System.exit(0);
	}

	static void kil(int val) {
		IO.out(String.valueOf(val));
		IO.flush();
		System.exit(0);
	}

	static void kil(long val) {
		IO.out(String.valueOf(val));
		IO.flush();
		System.exit(0);
	}

	static void kil(char val) {
		IO.out(String.valueOf(val));
		IO.flush();
		System.exit(0);
	}

	static void kil(float val) {
		IO.out(String.valueOf(val));
		IO.flush();
		System.exit(0);
	}

	static void kil(double val) {
		IO.out(String.valueOf(val));
		IO.flush();
		System.exit(0);
	}

	static void kil(boolean val) {
		IO.out(String.valueOf(val));
		IO.flush();
		System.exit(0);
	}

	static String nes() {
		return IO.next();
	}

	static int nei() {
		return IO.nextInt();
	}

	static long nel() {
		return IO.nextLong();
	}

	static double ned() {
		return IO.nextDouble();
	}

	static char nec() {
		return IO.nextChar();
	}

	static String[] nss(int n) {
		String[] as = new String[n];
		for (int i = 0; i < n; i++) {
			as[i] = IO.next();
		}
		return as;
	}

	static int[] nis(int n) {
		int[] as = new int[n];
		for (int i = 0; i < n; i++) {
			as[i] = IO.nextInt();
		}
		return as;
	}

	static long[] nls(int n) {
		long[] as = new long[n];
		for (int i = 0; i < n; i++) {
			as[i] = IO.nextLong();
		}
		return as;
	}

	static double[] nds(int n) {
		double[] as = new double[n];
		for (int i = 0; i < n; i++) {
			as[i] = IO.nextDouble();
		}
		return as;
	}

	static char[] ncs(int n) {
		char[] as = new char[n];
		for (int i = 0; i < n; i++) {
			as[i] = IO.nextChar();
		}
		return as;
	}

	static String[][] nss2(int n, int m) {
		String[][] as = new String[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				as[i][j] = IO.next();
			}
		}
		return as;
	}

	static int[][] nis2(int n, int m) {
		int[][] as = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				as[i][j] = IO.nextInt();
			}
		}
		return as;
	}

	static long[][] nls2(int n, int m) {
		long[][] as = new long[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				as[i][j] = IO.nextLong();
			}
		}
		return as;
	}

	static double[][] nds2(int n, int m) {
		double[][] as = new double[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				as[i][j] = IO.nextDouble();
			}
		}
		return as;
	}

	static char[][] ncs2(int n, int m) {
		char[][] as = new char[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				as[i][j] = IO.nextChar();
			}
		}
		return as;
	}

	static int parseInt(String val) {
		return Integer.parseInt(val);
	}

	static int parseInt(char val) {
		return Integer.parseInt(String.valueOf(val));
	}

	static long parseLong(String val) {
		return Long.parseLong(val);
	}

	public static void main(String[] args) {
		try {
			solve();
			IO.flush();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

class UnionFind {
	int[] parent;
	int[] rank;
	UnionFindRoot[] root;

	UnionFind(int n) {
		parent = new int[n];
		root = new UnionFindRoot[n];
		rank = new int[n];

		for (int i = 0; i < n; i++) {
			parent[i] = i;
			root[i] = new UnionFindRoot(i);
		}
	}

	int rootIndex(int i) {
		int p = parent[i];
		if (i == p) {
			return i;
		}
		return parent[i] = rootIndex(p);
	}

	UnionFindRoot root(int i) {
		int p = parent[i];
		if (i == p) {
			return root[i];
		}
		return root[parent[i] = rootIndex(p)];
	}

	void union(int i, int j) {
		int root1 = rootIndex(i);
		int root2 = rootIndex(j);

		if (root2 == root1)
			return;

		UnionFindRoot newRoot = root[root1].combine(root[root2]);

		if (rank[root1] > rank[root2]) {
			parent[root2] = root1;
			root[root1] = newRoot;
		} else if (rank[root2] > rank[root1]) {
			parent[root1] = root2;
			root[root2] = newRoot;
		} else {
			parent[root2] = root1;
			root[root1] = newRoot;
			rank[root1]++;
		}
	}

	int size(int x) {
		return root(x).size;
	}

	class UnionFindRoot {
		int size;

		UnionFindRoot(int index) {
			size = 0;
		}

		UnionFindRoot combine(UnionFindRoot another) {
			UnionFindRoot newRoot = new UnionFindRoot(0);
			newRoot.size = size + another.size;
			return newRoot;
		}
	}
}

final class IO {
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out, false);
	private static final byte[] buffer = new byte[1024];
	private static int ptr = 0;
	private static int len = 0;

	private static boolean hasNextByte() {
		if (ptr < len)
			return true;
		ptr = 0;
		try {
			len = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return len > 0;
	}

	private static int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	static boolean hasNext() {
		byte c;
		while (hasNextByte() && ((c = buffer[ptr]) < '!' || c > '~'))
			ptr++;
		return hasNextByte();
	}

	static String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (b >= '!' && b <= '~') {
			sb.append((char) b);
			b = readByte();
		}
		return sb.toString();
	}

	static char nextChar() {
		if (!hasNext())
			throw new NoSuchElementException();
		return (char) readByte();
	}

	static long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		int sign = 1;
		int b = readByte();
		if (b == '-') {
			sign = -1;
			b = readByte();
		}
		if (b < '0' || '9' < b)
			throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9')
				n = n * 10 + b - '0';
			else if (b == -1 || b < '!' || b > '~')
				return n * sign;
			else
				throw new NumberFormatException();
			b = readByte();
		}
	}

	static int nextInt() {
		if (!hasNext())
			throw new NoSuchElementException();
		int n = 0;
		int sign = 1;
		int b = readByte();
		if (b == '-') {
			sign = -1;
			b = readByte();
		}
		if (b < '0' || '9' < b)
			throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9')
				n = n * 10 + b - '0';
			else if (b == -1 || b < '!' || b > '~')
				return n * sign;
			else
				throw new NumberFormatException();
			b = readByte();
		}
	}

	static double nextDouble() {
		return Double.parseDouble(next());
	}

	static void out(String val) {
		out.println(val);
	}

	static void flush() {
		out.flush();
	}
}


Measured memory_bytes: 32704