#incude <iostream>
using namespace std;

typedef unsigned long long i64;

#define BIGNUM 1000000007
#define remainder(x) ((x) % BIGNUM)

int N;
i64 *A;

void Solve()
{
  i64 sum = 0LL;
  for (int i = 1; i < N; ++i){
    for (int j = i + 1; j <=N; ++j){
      i64 exor = A[i] xor A[j];
      sum += remainder(exor);
    }
//    sum = remainder(sum);
  }
  cout << remainder(sum) << endl;
}

void Init()
{
  cin >> N;
  A = new i64[N + 2];
  for (int i = 1; i <= N; ++i)
    cin >> A[i];
}

void Clean()
{
  delete[] A;
}

int main()
{
  Init();
  Solve();
  Clean();
  return 0;
}
