#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int LOG = 61;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<unsigned long long> a(n + 1, 0LL);
  vector<vector<int> > dp(LOG, vector<int>(2, 0));
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    for (int j = 0; j < LOG; j++) {
      unsigned long long st = 1LL << j;
      bool bit = a[i] & st;
      dp[j][bit]++;
    }
  }
  long long ans = 0LL;
  for (int i = 0; i < LOG; i++) {
    ans += (dp[i][0] * 1LL * dp[i][1] * (1LL << i));
    ans %= MOD;
  }
  cout << ans << '\n';
  return 0;
}
