#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  vector<int> v(N);
  cin >> N;
  int S = 0;
  int j = 1;
  int mod = 1000000007;
  for (int i = 0; i < N; i++)
  {
    cin >> v.at(i);
  }
  vector<int> Z(N);
  while (v != Z)
  {
    int m = 0;
    int n = 0;
    for (int i = 0; i < N; i++)
    {
      if (v.at(i) % 2 == 1)
      {
        m += 1;
      }
      else
      {
        n += 1;
      }
      v.at(i) /= 2
    }
    S += (m * n) * j;
    j *= 2
  }
  S %= mod;
  cout << S << endl;
}