#include <bits/stdc++.h>
using namespace std;
using ipair = pair<int, int>;
long long INF = 1e16 + 7;
long long mod = 998244353;
bool operator>(const ipair a, const ipair b) { return a.first > b.first; }
int main() {
  int N;
  cin >> N;
  vector<long long> A(N + 1);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  long long ans = 0;
  long long MOD = 1e9 + 7;
  for (int k = 0; k < (60); ++k) {
    long long cnt_x = 0;
    long long cnt_y = 0;
    for (int i = 0; i < (N); ++i)
      if (A[i] >> k & 1) cnt_x++;
    cnt_y = N - cnt_x;
    long long tmp = cnt_x * cnt_y;
    for (int i = 0; i < (k); ++i) tmp *= 2;
    ans += tmp;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
