#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
const long long int MOD = 1e9 + 7;
const long long int INF = 1e10;
const long double PI = (acos(-1));
long long int pow(long long int num) {
  long long int res = 1;
  for (long long int i = 0; i < (long long int)(num); i++) {
    res *= 2;
    res %= MOD;
  }
  return res;
}
signed main() {
  long long int N;
  cin >> N;
  vector<long long int> v(60, 0);
  for (long long int i = 0; i < (long long int)(N); i++) {
    long long int A;
    cin >> A;
    for (long long int j = 0; j < (long long int)(60); j++) {
      v[j] += A % 2;
      A /= 2;
    }
  }
  long long int ans = 0;
  for (long long int i = 0; i < (long long int)(60); i++) {
    ans += (v[i] * (N - v[i]) * pow(i)) % MOD;
    ans %= MOD;
  }
  cout << ans;
}
