#Lutece3025. 落叶纷飞

落叶纷飞

Migrated from Lutece 3025 落叶纷飞

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

一场秋雨过后,银杏树的叶子掉了好多!

AinAin 一共收集了 nn 片银杏树叶,并给第 ii 片树叶赋予了美丽值 aia_i

现在他想知道这些树叶的总体美丽度 BB。总体美丽度的计算方法如下:

对于所有四元组 (i,j,k,l)(i,j,k,l) (1i,j,k,ln)(1 \le i,j,k,l \le n), 计算 :

S=(ai&aj) (akal)S=(a_i \& a_j)\bigoplus \ (a_k | a_l)

若有:

S  0 (mod 3)S \ \equiv \ 0 \ (mod \ 3)

则总体美丽度:

$B \ += {fib}_{a_i \& a_j} \times \ {fib}_{a_k | a_l}$

其中 fibi{fib}_i 代表斐波那契数列的第 ii 项。

由于总体美丽度可能很大,所以你只需要告诉 AinAin 总体美丽度对 998244353998244353 取模的结果。

Input

第一行一个整数 nn (1n106)(1 \le n \le 10^{6})。 第二行 nn 个整数 a1,a2,...,ana_1,a_2,...,a_n (1a1,a2,...,an2201)(1 \le a_1,a_2,...,a_n \le 2^{20}-1)

Output

一行一个整数,代表所求结果。

Samples

1
14
142129

Constraints

1n1061 \le n \le 10^{6}1a1,a2,...,an22011 \le a_1,a_2,...,a_n \le 2^{20}-1

Resources

2023 UESTC ICPC Training for Math