#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
  long long n, i;
  scanf("%lld", &n);
  long long a[n + 10], ans = 0;
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (i = 0; i < 63; i++) {
    long long ck = (1LL << i);
    long long on = 0;
    for (long long j = 0; j < n; j++)
      if (a[j] & ck) on++;
    long long to = (on * (n - on)) % mod;
    ans += (to * ck);
    ans %= mod;
  }
  cout << ans << endl;
}
