#include <bits/stdc++.h>
using namespace std;
const int N = 62, M = 2 * N, mod = 1e9 + 7;
int n;
long long a[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  int res = 0;
  for (int i = 0; i < N; i++) {
    int one = 0, zero = 0;
    for (int j = 0; j < n; j++)
      if (a[j] & 1LL << i)
        one++;
      else
        zero++;
    res =
        ((long long)res + (1LL << i) % mod * (long long)one % mod * zero) % mod;
  }
  printf("%d\n", res);
  return 0;
}
