You are given an integer array nums.

The strength of the array is defined as the bitwise OR of all its elements.

A subsequence is considered effective if removing that subsequence strictly decreases the strength of the remaining elements.

Return the number of effective subsequences in nums. Since the answer may be large, return it modulo 109 + 7.

The bitwise OR of an empty array is 0.

 

Example 1:

Input: nums = [1,2,3]

Output: 3

Explanation:

Example 2:

Input: nums = [7,4,6]

Output: 4

Explanation:​​​​​​​

Example 3:

Input: nums = [8,8]

Output: 1

Explanation:

Example 4:

Input: nums = [2,2,1]

Output: 5

Explanation:

 

Constraints: