#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int Max_Num = 300010;
int main() {
  int N;
  cin >> N;
  long long A[Max_Num];
  for (int i = 0; i < (int)(N); i++) cin >> A[i];
  long long ans = 0;
  for (int bit = 0; bit < (int)(61); bit++) {
    int one = 0;
    for (int i = 0; i < (int)(N); i++) {
      if (1LL << bit & A[i]) one++;
    }
    long long m = 1;
    for (int i = 0; i < (int)(bit); i++) {
      m *= 2;
      m %= mod;
    }
    ans += m * one * (N - one);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
