#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) cin >> v[i];
  long long int sum1, ans = 0;
  for (long long int i = 0; i < 60; i++) {
    sum1 = 0;
    for (long long int j = 0; j < n; j++) {
      sum1 += (v[j] & 1ll);
      v[j] /= 2;
    }
    long long int temp;
    temp = (sum1 * (n - sum1)) % 1000000007;
    temp = temp * ((1 << uint(i)) % 1000000007);
    temp %= 1000000007;
    ans += temp;
    ans %= 1000000007;
  }
  ans %= 1000000007;
  cout << ans << "\n";
  return 0;
}
