#include <bits/stdc++.h>
using namespace std;
const int N = 3000300;
const long long mod = 1e9 + 7;
long long n;
long long ans = 0;
long long arr[3 * 100005], ar[60][3 * 100005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> arr[i];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 60; j++) {
      if (1ll << j & arr[i]) {
        ar[j][i] = 1;
      }
    }
  }
  for (int j = 0; j < 60; j++) {
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      cnt += ar[j][i];
    }
    cnt *= (n - cnt);
    cnt %= mod;
    ans += cnt * (1ll << j);
    ans %= mod;
  }
  if (ans < 0) ans += mod;
  cout << ans;
}
