#include <bits/stdc++.h>
using namespace std;
long long n, a[300005], bi[62], oddcnt, temp, ans;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  bi[0] = 1;
  for (int i = 1; i < 62; i++) {
    bi[i] = (bi[i - 1] * 2) % mod;
  }
  for (int i = 0; i < 60; i++) {
    oddcnt = 0;
    temp = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] % 2) oddcnt++;
      a[j] /= 2;
    }
    temp = oddcnt * (n - oddcnt);
    temp = (temp * bi[i]) % mod;
    ans += temp;
    ans %= mod;
  }
  cout << ans << endl;
}
