#include <bits/stdc++.h>
using namespace std;
const int N = 300005, M = 1000000007;
long long a[N], cnt[66];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    for (long long j = 0; (1LL << j) <= a[i]; j++) {
      if ((1LL << j) & a[i]) {
        cnt[j]++;
      }
    }
  }
  long long res = 0;
  for (long long i = 0; i < 66; i++) {
    long long temp = (cnt[i] * (n - cnt[i])) % M;
    res += (temp * (1LL << i)) % M;
    res %= M;
  }
  printf("%lld", res);
  return 0;
}
