#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, md = 1e9 + 7;
inline int add(int x, int y) {
  x += y;
  if (x >= md) x -= md;
  return x;
}
inline int mul(int x, int y) { return 1ll * x * y % md; }
int a[N];
int n, ans;
int main() {
  cin >> n;
  for (register int i = 1; i <= n; i++) cin >> a[i];
  for (register int j = 0; j < 60; j++) {
    int cnt = 0;
    for (register int i = 1; i <= n; i++) cnt += ((a[i] >> j) & 1);
    ans = add(ans, mul((1LL << j) % md, mul(cnt, n - cnt)));
  }
  cout << ans;
  return 0;
}
