#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int nm = 62;
const long long mod = 1000000007;
int n;
long long a[nm];
int cnt[nm][2];
long long powmod[nm];
int main() {
  powmod[0] = 1;
  for (int i = 1; i < nm; ++i) {
    powmod[i] = (powmod[i - 1] * 2) % mod;
  }
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < nm; ++j) {
      cnt[j][(a[i] >> j) & 1]++;
    }
  }
  long long res = 0;
  for (int i = 0; i < nm; ++i) {
    long long tmp = (cnt[i][0] * cnt[i][1]) % mod;
    tmp = (tmp * powmod[i]) % mod;
    res = (res + tmp) % mod;
  }
  printf("%lld\n", res);
}
