Dreamoon like sequence so create problem sequence can not find OEIS you give integer d m find number array satisfy follow constraint the length n n ge 1 1 le a_1 a_2 dots a_n le d Define array b length n follow b_1 a_1 forall 1 b_i b_i 1 oplus a_i oplus bitwise exclusiveor xor after construct array b constraint b_1 b_2 dots b_n 1 b_n hold since number possible array large need find answer modulo m