#include <bits/stdc++.h>
using namespace std;
int chh;
const int N = 300005, MOD = 1000000007;
int n;
long long a[N];
int main() {
  long long ans, t, x, tmp;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < (n); i++) cin >> a[i];
    ans = 0, t = 1;
    for (int k = 0; k < (60); k++) {
      x = 0;
      for (int i = 0; i < (n); i++) x += a[i] & 1, a[i] >>= 1;
      tmp = x * (n - x);
      ans = (ans + tmp * t) % MOD;
      t = (t << 1) % MOD;
    }
    cout << ans << '\n';
  }
  return 0;
}
