#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using namespace std;
const ll mod = 1e9 + 7;
int n;
ll a[300005], sum;
ll num;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (int i = (1); i <= (n); ++i) cin >> a[i];
  for (int i = (0); i <= (61); ++i) {
    num = 0;
    for (int j = (1); j <= (n); ++j) num += ((a[j] & (1ll << i)) > 0);
    sum = (sum + (((num * 1ll * (n - num)) % mod) * (1ll << i) % mod)) % mod;
  }
  cout << sum;
}
