#include <bits/stdc++.h>
using namespace std;
long long M = 1000000007;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < 61; i++) {
    long long count = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] >> i & 1) count++;
    }
    long long two = 1;
    for (int j = 0; j < i; j++) {
      two *= 2;
    }
    long long p = count * (n - count) % M;
    ans += two * p;
    ans %= M;
  }
  cout << ans << endl;
  return 0;
}
