#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1 << 29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void solve() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (int i = 0; i < 60; ++i) {
    int cnt = 0;
    for (int j = 0; j < (int)(a.size()); j++) {
      if ((a[j] >> i) & 1) cnt++;
    }
    cnt = cnt * (n - cnt);
    long long num = cnt;
    for (int j = 0; j < i; ++j) {
      num *= 2;
    }
    ans += num;
  }
  cout << ans % MOD << endl;
  return;
}
int main() {
  solve();
  return 0;
}
