#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 3e5 + 7;
long long a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  long long s = 0, s1 = 0, s2 = 0;
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (int i = 0; i <= 60; i++) {
    s1 = s2 = 0;
    for (int j = 0; j < n; j++) {
      if (((a[j] >> i) & 1) == 1)
        s1++;
      else
        s2++;
    }
    s = (s + s1 * s2 * (1ll << i)) % mod;
  }
  printf("%lld\n", s);
  return 0;
}
