#include <bits/stdc++.h>
using namespace std;
const unsigned long long inf = 1e17;
const unsigned long long N = 3e5 + 10;
const unsigned long long bits = 60;
const unsigned long long mod = 1e9 + 7;
unsigned long long power(unsigned long long x, unsigned long long n) {
  if (n == 0) {
    return 1;
  }
  unsigned long long ans = power(x, n / 2);
  ans *= ans;
  ans %= mod;
  if (n % 2) {
    ans *= x;
    ans %= mod;
  }
  return ans;
}
unsigned long long modInv(unsigned long long n) { return power(n, mod - 2); }
int main() {
  unsigned long long n;
  cin >> n;
  vector<unsigned long long> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  unsigned long long ans = 0;
  for (int x = 0; x <= bits; x++) {
    unsigned long long var = pow(2, x);
    unsigned long long e = 0;
    for (int i = 0; i < n; i++) {
      if ((arr[i] & var) == var) {
        e++;
      }
    }
    ans += (((e * (n - e)) % mod) * var) % mod;
    ans %= mod;
  }
  cout << ans << "\n";
}
