#include <bits/stdc++.h>
using namespace std;
unsigned long long MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  unsigned long long ans = 0;
  vector<unsigned long long> numbers(N);
  for (int i = 0; i < (int)(N); i++) {
    cin >> numbers[i];
  }
  for (int i = 0; i < (int)(60); i++) {
    long long x = 0;
    for (int j = 0; j < (int)(N); j++)
      if (numbers[j] >> i & 1) x++;
    long long plus = x * (N - x) % MOD;
    for (int j = 0; j < (int)(i); j++) plus = plus << 1 % MOD;
    ans += plus;
    ans %= MOD;
  }
  cout << ans << endl;
}
