#include <bits/stdc++.h>
constexpr long long mop = 1000000007;
constexpr long long mop2 = 998244353;
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<vector<long long>> a(n);
  vector<long long> sum(60);
  for (long long i = 0; i < n; i++) {
    a[i].resize(60);
  }
  for (long long i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    for (long long j = 0; j < 60; j++) {
      a[i][j] = tmp % 2;
      sum[j] += a[i][j];
      tmp /= 2;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    long long pow = 1;
    for (long long j = 0; j < 60; j++) {
      if (a[i][j] == 0) {
        ans += pow * sum[j];
      } else {
        ans += pow * (n - sum[j]);
      }
      ans %= mop;
      pow *= 2;
      pow %= mop;
    }
  }
  cout << ans / 2 << endl;
}
