#include <bits/stdc++.h>
using namespace std;
int n;
long long ans = 0, a[300000], b[60] = {};
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    for (int j = 0; j < 60; j++) {
      if (a[i] & (1LL << j)) {
        b[j]++;
      }
    }
  }
  for (int i = 0; i < 60; i++) {
    long long x = (1LL << i);
    x %= 1000000007;
    ans += x * b[i] * ((long long)n - b[i]);
    ans %= 1000000007;
  }
  printf("%lld\n", ans);
}
