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