The Yakumo Family
题号:NC256205
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Ran feels boring at home, and wants to propose a math problem with Yukari and Chen!
So here's The Yakumo Family Problem:
Given an integer array a, try to calculate the value of the following equation modulo 998244353:

\sum_{1\le l_1\le r_1<l_2\le r_2<l_3\le r_3\le n}XOR(l_1, r_1)\times XOR(l_2, r_2)\times XOR(l_3, r_3)

XOR(l,r) means a_l\oplus a_{l+1}\oplus a_{l+2}\dots\oplus a_r, and \oplus means bitwise XOR.

输入描述:

The first line contains one integer n (3\le n\le 2\times 10^5), which means the length of a.
The next line contains n integers, the i-th integer means the value of a_i (0\le a_i\le 10^9).

输出描述:

One integer, means the value of the equation modulo 998244353.
示例1

输入

复制
3
1 2 3

输出

复制
6
示例2

输入

复制
4
1 1 1 0

输出

复制
2