#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000 * 1000 * 1000 + 7;
int main() {
  {
    if (fopen("input.txt", "r")) {
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  }
  int n;
  cin >> n;
  vector<long long> vec(60);
  for (int i = 0; i != n; ++i) {
    long long a;
    cin >> a;
    for (long long j = 0; j != 60; ++j)
      if (a & (1LL << j)) ++vec[j];
  }
  long long ans = 0, p = 1;
  for (int i = 0; i != 60; ++i) {
    ans += (p * ((vec[i] * (n - vec[i])) % mod)) % mod;
    ans %= mod;
    p *= 2;
  }
  cout << ans;
  return 0;
}
