#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 100;
long long mod = 1e9 + 7;
long long a[N];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i <= 60; i++) {
    int cnt0 = 0, cnt1 = 0;
    for (int j = 1; j <= n; j++) {
      if (1 & (a[j] >> i))
        cnt1++;
      else
        cnt0++;
    }
    long long bit = 1ll * 1 << i;
    ans = (ans + (bit % mod) * 1ll * (cnt0 * cnt1 % mod)) % mod;
  }
  cout << ans % mod;
  return 0;
}
