#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = (1LL << 62);
long long cul0[61];
long long cul1[61];
int main() {
  long long N;
  scanf("%lld", &N);
  vector<long long> a_list(N);
  for (long long i = 0; i < N; i++) {
    long long v;
    scanf("%lld", &v);
    a_list[i] = v;
  }
  for (long long i = 1; i <= a_list.size(); i++) {
    for (long long k = 0; k < 60; k++) {
      bool t = (a_list[i - 1] & (1LL << k));
      if (t) {
        cul1[k]++;
      } else {
        cul0[k]++;
      }
    }
  }
  long long ans = 0;
  for (long long k = 0; k < 60; k++) {
    long long base = 1LL << k;
    long long count = cul0[k] * cul1[k] % MOD;
    long long plus = base * count;
    ans += plus;
    ans %= MOD;
  }
  cout << ans << endl;
}
