#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int N;
int A1[61], A0[61];
int main(void) {
  cin >> N;
  for (int j = 0; j < (N); j++) {
    long long int A;
    cin >> A;
    for (int i = 0; i < 60; i++) {
      if (A % 2 == 0)
        A0[i]++;
      else
        A1[i]++;
      A /= 2;
    }
  }
  long long int count = 0;
  for (long long int i = 0; i < 60; i++) {
    long long int r = pow(2, i);
    count += (((A1[i] * A0[i]) % MOD) * (r % MOD)) % MOD;
    count %= MOD;
  }
  cout << count % MOD << endl;
  return 0;
}
