#include <bits/stdc++.h>
using namespace std;
const long long int INF = (long long int)1e18;
int main() {
  int N;
  cin >> N;
  vector<long long int> a(N);
  for (int i = (0); i < (N); ++i) {
    cin >> a[i];
  }
  long long int ans = 0;
  for (int i = (0); i < (61); ++i) {
    int cnt0 = 0;
    int cnt1 = 0;
    for (int i = (0); i < (N); ++i) {
      if (a[i] & 1 == 1) {
        cnt1++;
      } else {
        cnt0++;
      }
    }
    for (int i = (0); i < (N); ++i) {
      a[i] = a[i] >> 1;
    }
    long long int tmp = 1;
    tmp = tmp << i;
    tmp %= 1000000007;
    ans += tmp * cnt0 * cnt1;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
