#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const double pi = acos(-1);
const int inf = 1e9;
const long long INF = 1e18;
int main() {
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(false);
  long long n, a[300005] = {}, ans = 0, x, y;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 62; i++) {
    x = 0, y = 0;
    for (int j = 0; j < n; j++) {
      if ((1LL << i) & a[j]) {
        x++;
      } else {
        y++;
      }
    }
    ans += ((1LL << i) % MOD) * (x % MOD) * (y % MOD);
    ans %= MOD;
  }
  cout << ans << endl;
}
