Bitwise ORs of Subarrays

Given an array arr of non-negative integers, return the number of distinct bitwise OR values of all non-empty subarrays. As a subarray grows, its OR can only accumulate new bits, so the set of distinct ORs ending at any position is bounded by the number of bits (≤ 32).

Examples
Input: [1,1,2]
Output: 3
Hints

Bitwise ORs of Subarrays

Given an array arr of non-negative integers, return the number of distinct bitwise OR values of all non-empty subarrays. As a subarray grows, its OR can only accumulate new bits, so the set of distinct ORs ending at any position is bounded by the number of bits (≤ 32).