#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
mt19937 rnd(time(0));
const long long INF = 1e9;
constexpr long long mod = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  vector<int> arr(65);
  for (long long i = 0, x; i < n; i++) {
    cin >> x;
    for (int j = 0; j < 65; j++)
      if (x & (1LL << j)) arr[j]++;
  }
  long long ans = 0;
  for (int i = 0; i < 65; i++)
    ans = (ans + (((((1LL << i) % mod) * arr[i]) % mod) * (n - arr[i])) % mod) %
          mod;
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
