#include <bits/stdc++.h>
using namespace std;
int N;
long long a[300010];
long long MOD = 1000000007;
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &(a[i]));
  }
  long long ans = 0;
  long long base = 1;
  for (int i = 0; i <= 60; i++) {
    long long oneCount = 0;
    long long zeroCount = 0;
    for (int i = 0; i < N; i++) {
      if (a[i] % 2 == 0)
        zeroCount++;
      else
        oneCount++;
      a[i] = a[i] / 2;
    }
    long long section = 0;
    section = (oneCount * zeroCount) % MOD;
    section = (section * base) % MOD;
    ans = (ans + section) % MOD;
    base = base * 2;
  }
  printf("%lld\n", ans);
  return 0;
}
