            #include<iostream>
            int main(){
              int N;
              long A[300001];
              long result = 0;
              std :: cin >> N;
              std::cin >> A;
              for(int i = 0; i<=N - 2;i++){
                for(int j = i+1;j<=N - 1;j++){
                  result += (A[i]^A[j]);
                  result = result % (1000000000+7);
                }
              }
              result = result % (1000000000+7);
              std :: cout << result;
              return 0;
            }