#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
const long long MOD = 1000000007;
int main() {
  long long N, a[60] = {0};
  cin >> N;
  for (long long i = 0; i < (long long)(N); ++i) {
    long long temp;
    cin >> temp;
    long long x = 1;
    for (long long j = 0; j < (long long)(60); ++j) {
      if (temp & x) {
        a[j]++;
      }
      x *= 2;
    }
  }
  long long ans = 0;
  long long x = 1;
  for (long long i = 0; i < (long long)(60); ++i) {
    ans += ((a[i] * (N - a[i])) * x);
    ans %= MOD;
    x *= 2;
  }
  cout << ans << endl;
  return 0;
}
