#include <bits/stdc++.h>
using namespace std;
using Int = long long;
const int mo = 1e9 + 7;
int N;
int counter[65];
signed main() {
  cin >> N;
  for (int i = 0; i < (int)(N); ++i) {
    Int A;
    cin >> A;
    for (int j = 0; j < (int)(61); ++j) {
      if ((A >> j) & 1) counter[j]++;
    }
  }
  Int ans = 0;
  for (int i = 0; i < (int)(61); ++i) {
    ans += (1ll << i) * (Int)counter[i] * (Int)(N - counter[i]);
    ans %= mo;
  }
  cout << ans << endl;
}
