#include <bits/stdc++.h>
using namespace std;
unsigned long long int inf = 1e18;
const unsigned long long int N = 4e5 + 5;
unsigned long long int mod = 1e9 + 7;
long long powmod(long long a, long long b) {
  long long res = 1;
  if (a >= mod) a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    if (res >= mod) res %= mod;
    a = a * a;
    if (a >= mod) a %= mod;
  }
  return res;
}
unsigned long long int arr[N];
unsigned long long int sumXOR(unsigned long long int n) {
  unsigned long long int sum = 0;
  for (unsigned long long int i = 0; i < 62; i++) {
    unsigned long long int k = 1ll << i;
    unsigned long long int ct = 0;
    for (unsigned long long int i = 0; i < n; ++i) {
      if (arr[i] & k) ct++;
    }
    sum = (sum + (k % mod) * (ct % mod) * ((n - ct) % mod)) % mod;
  }
  return sum % mod;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  unsigned long long int tt = 1;
  while (tt--) {
    unsigned long long int n;
    cin >> n;
    for (unsigned long long int i = 0; i < n; i++) cin >> arr[i];
    unsigned long long int ans = sumXOR(n);
    cout << ans % mod << '\n';
  }
  return 0;
}
