#include <bits/stdc++.h>
using namespace std;
const long double PI = (acos(-1));
static const int mod = 1e9 + 7;
int main() {
  int n, tmp;
  scanf("%d", &n);
  long long ans = 0;
  vector<long long> a(n);
  vector<int> zero(60, 0), one(60, 0);
  for (int i = 0; i < (int)(n); i++) scanf("%lld", &a[i]);
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(60); j++) {
      if (a[i] < (1ll << j))
        zero[j] += 1;
      else if (a[i] & (1ll << j))
        one[j] += 1;
      else
        zero[j] += 1;
    }
  }
  for (int i = 0; i < (int)(zero.size()); i++) {
    ans = (ans + (1ll << i) % mod * zero[i] * one[i] % mod) % mod;
  }
  cout << ans << endl;
  return 0;
}
