#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 200;
int n;
long long int Ans;
long long int a[maxn];
long long int wei[maxn][63], num[2][63];
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) scanf("%lld", &a[i]);
  for (int i = (1); i <= (n); ++i) {
    for (int k = (0); k <= (61); ++k)
      wei[i][k] = a[i] % 2, a[i] >>= 1, num[wei[i][k]][k]++;
  }
  long long int no = 1;
  Ans = 0;
  for (int k = (0); k <= (61); ++k) {
    Ans = (Ans + no * num[0][k] * num[1][k]) % 1000000007LL;
    no = no * 2LL % 1000000007LL;
  }
  cout << Ans << endl;
  return 0;
}
