#include <bits/stdc++.h>
using namespace std;
bool compare(pair<long long int, long long int> a,
             pair<long long int, long long int> b) {
  return (a.first * b.second) < (a.second * b.first);
}
const int mod = 1e9 + 7;
const long long int inf = long long int(1e18);
long long int modexp(long long int x, long long int n) {
  if (n == 0) return 1;
  if (n % 2 == 0) return modexp((x * x) % mod, n / 2);
  return (x * modexp((x * x) % mod, n / 2)) % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long int> a(n, 0);
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long int ans = 0;
  for (int i = 0; i < 60; ++i) {
    int sb = 0, usb = 0;
    long long int temp = 0;
    for (int j = 0; j < n; ++j) {
      if (a[j] % 2 == 0)
        usb++;
      else
        sb++;
      a[j] /= 2;
    }
    temp = (sb * usb) % mod;
    temp = (temp * long long int(pow(2, i))) % mod;
    ans = (ans + temp) % mod;
  }
  cout << ans << "\n";
}
