#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1000;
long long w[N];
long long cnt[64];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &w[i]);
    for (int j = 0; j <= 62; ++j) {
      cnt[j] += (w[i] >> j) & 1;
    }
  }
  long long sum = 0;
  long long mod = 1e9 + 7;
  for (int i = 0; i <= 62; ++i) {
    sum += 1LL * (n - cnt[i]) * cnt[i] * (1LL << i);
    sum %= mod;
  }
  cout << sum << endl;
}
