#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long a[300001];
int main() {
  long long n, one = 0, zero = 0, ans = 0, d = 1;
  scanf("%I64d", &n);
  for (int i = 0; i < n; i++) scanf("%I64d", &a[i]);
  for (int i = 0; i < 61; i++) {
    long long bit = 1LL << i;
    one = zero = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & bit) {
        one++;
      } else
        zero++;
    }
    ans += (bit % mod) * ((one * zero) % mod) % mod;
  }
  cout << ans % mod << endl;
}
