#include <bits/stdc++.h>
const int MAX_BI_DIGIT = 60;
const long MOD_CONST = 1000000007;
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  long long sum = 0;
  for (int j = 0; j < MAX_BI_DIGIT; j++) {
    long long cnt_0 = 0;
    long long cnt_1 = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] >> j & 1) {
        cnt_1++;
      } else {
        cnt_0++;
      }
    }
    sum += ((1LL << j) % MOD_CONST * (cnt_0 * cnt_1)) % MOD_CONST;
    sum %= MOD_CONST;
  }
  sum %= MOD_CONST;
  printf("%lld\n", sum);
  return 0;
}
