#include <bits/stdc++.h>
using namespace std;
long long dp[62] = {};
int main() {
  long long n, a, cur = 1, ans = 0;
  cin >> n;
  for (long long i = (long long)0; i < (long long)n; i++) {
    cin >> a;
    for (long long x = (long long)0; x < (long long)62; x++) {
      if (a % 2 == 1) dp[x] += 1;
      a /= 2;
    }
  }
  for (long long i = (long long)0; i < (long long)62; i++) {
    ans += cur * dp[i] * (n - dp[i]);
    cur *= 2;
    cur %= 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
  ;
  return 0;
}
