#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 20, BIT = 60, MOD = 1e9 + 7;
int n;
long long a[N], ans;
long long mul(long long a, long long b, long long c) {
  return ((a * b) % MOD * c) % MOD;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (int j = 0; j < BIT; j++) {
    int zero = 0, one = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 1)
        one++;
      else
        zero++;
      a[i] /= 2;
    }
    ans += mul(zero, one, (1ll << j));
    ans %= MOD;
  }
  printf("%lld", ans);
}
