#include <bits/stdc++.h>
using namespace std;
const int Mod = 1000000007;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10),
      cout << fixed;
  int n;
  cin >> n;
  vector<long long> arr(n);
  vector<vector<int>> cnt(2, vector<int>(65, 0));
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    for (int bit = 0; bit < 60; ++bit) {
      ans = (ans + cnt[(arr[i] & (1LL << bit)) == 0][bit] * (1LL << bit)) % Mod;
      ++cnt[(arr[i] & (1LL << bit)) != 0][bit];
    }
  }
  cout << ans << '\n';
  return 0;
}
