#include <bits/stdc++.h>
using namespace std;
const int N = 20;
struct node {
  int x, y;
};
int n, x[2][66];
long long ans, t, a;
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; ++i) {
    scanf("%lld", &a);
    for (register int j = 0; j <= 60; ++j) ++x[(a & (1ll << j)) ? 1 : 0][j];
  }
  for (register int i = 0; i <= 60; ++i)
    ans = (ans + (1ll << i) * x[0][i] * x[1][i]) % 1000000007;
  printf("%lld", ans);
  return 0;
}
