#include <bits/stdc++.h>
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
using namespace std;
long long ttt = 1;
long long n, a, b[65], ans;
void solve() {
  scanf("%I64d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &a);
    for (int j = 0; j < 61; j++)
      if (a & (1LL << j)) b[j]++;
  }
  for (int i = 0; i < 61; i++)
    ans =
        (ans + (((b[i] * (n - b[i]) % 1000000007) * (1LL << i)) % 1000000007)) %
        1000000007;
  printf("%I64d", ans);
}
int main() {
  for (int i = 0; i < ttt; i++) solve();
}
