#include <bits/stdc++.h>
long long mod = 1e9 + 7;
using namespace std;
int boom[100];
int boom1[100];
long long ksm(long long a, long long b) {
  long long ans = 1;
  for (; b; b >>= 1, a *= a % mod)
    if (b & 1) ans = ans * a % mod;
  return ans % mod;
}
int main() {
  int n;
  cin >> n;
  long long t;
  for (int i = 0; i < n; i++) {
    cin >> t;
    int temp = 0;
    for (; t; t >>= 1) {
      if (t & 1) boom[temp]++;
      temp++;
    }
  }
  long long ans = 0;
  for (int i = 0; i <= 64; i++) {
    if (boom[i] != 0) boom1[i] = n - boom[i];
  }
  for (int i = 0; i <= 64; i++) {
    ans = (ans + (ksm(2, i) * ((boom[i] * boom1[i]) % mod) % mod) % mod) % mod;
  }
  cout << ans << endl;
}
