#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const unsigned long long mod = 1e9 + 7;
unsigned long long a[maxn];
unsigned long long quick_pow(int a, int b) {
  unsigned long long res = 1;
  while (b) {
    if (b & 1) (res *= a) %= mod;
    (a *= a) %= mod;
    b >>= 1;
  }
  return res;
}
bool ejz[maxn][64];
void fl() {
  freopen(".in", "r", stdin);
  freopen(".out", "w", stdout);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%ull", &a[i]);
    unsigned long long tmp = a[i];
    for (int j = 0; j <= 60; j++) {
      ejz[i][j] = tmp % 2;
      tmp /= 2;
    }
  }
  unsigned long long ans = 0;
  for (int i = 0; i <= 60; i++) {
    unsigned long long zero = 0, one = 0;
    for (int j = 1; j <= n; j++) {
      zero += (!ejz[j][i]);
      one += ejz[j][i];
    }
    unsigned long long val = quick_pow(2, i) % mod;
    unsigned long long num = zero * one % mod;
    (ans += num * val % mod) %= mod;
  }
  printf("%llu\n", ans);
  return 0;
}
