#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int main() {
  int N;
  ll ans = 0;
  cin >> N;
  vector<int> d(61, 0);
  for (int i = 0; i < N; i++) {
    ll A;
    cin >> A;
    for (int j = 59; j >= 0; j--) {
      ll c = pow(2, j);
      if (A >= c) {
        d[j]++;
        A -= c;
      }
    }
  }
  for (int i = 0; i <= 59; i++) {
    ll cnt = (N - d[i]) * d[i];
    ll c = pow(2, i) * cnt;
    c %= 1000000007;
    ans += c;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
