#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 3e5 + 50;
const long long mod = 1e9 + 7;
long long s[MAXN];
int main() {
  long long n;
  long long sum = 0;
  int k = 60;
  memset(s, 0, sizeof s);
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &s[i]);
  }
  for (int i = 0; i < k; i++) {
    int cnt = 0;
    for (int j = 0; j < n; j++)
      if (s[j] >> i & 1) cnt++;
    sum = (sum + (1LL << i) * cnt * (n - cnt)) % mod;
  }
  printf("%lld\n", sum);
  return 0;
}
